Josh,
Your Saving each PDF successfully, unfortunately your saving them all with the Assembly Filename.
Near the beginning of your code you call:
oFileName = ThisDoc.FileName(False) 'without extension
While looping through the oRefDocs, you again call:
oFileName = ThisDoc.FileName(False) 'without extenstion
This isn't setting the Filename to the new, open doc, it is still setting it to ThisDoc (Being the document which contains the rule... as such ThisDoc never changes while the rule is running)
For the sub parts, I would replace it with:
oFileName =System.IO.Path.GetFileNameWithoutExtension(oDrawDoc.FullFileName)
for the Assembly, I would replace it with
oAsmDrawingName = System.IO.Path.GetFileNameWithoutExtension(oAsmDrawingDoc.FullFileName)
Additionally, I had to add a "." on the one line for
oDataMedium.FileName = oFolder & "\" & oFileName & "pdf"
to make it
oDataMedium.FileName = oFolder & "\" & oFileName & ".pdf"
Your mileage may vary, but it seems the root of your problems are filenames
Hopefully this gets you sorted out. If you need further guidance after you sort those out, let us know.
Best of Luck
---------------------------------------------------------------------------------------------------------------------------------
If you find this reply helpful or insightful, please use the 'Accept as Solution' or 'Kudos' button below.