Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
My company is in the process of upgrading from Inventor 2016 to Inventor 2019. We have a custom print macro that we have used to create a job specific print as well as save that print as a job specific PDF. We are a small operation currently only 2 designers running Inventor, possibly a 3rd in the future. As of right now a we do not have Vault set up. I am very new to Visual Basic but I am slowly learning, the print macro I am using was from a previous employer who was generous enough to give me their file to modify for my use.
Ex. 123456.idw
45678-123456-Sht1.pdf
45678 is the job number, 123456 is the part number, and the sheet number generated from Inventor
The macro prompts with a textbox to manually fill in the job number and the file name is created from the textbox input.
I am testing using CutePDF Creator as it is free and it is one of the few I found that automatically populates the SaveAs field based on the file you have open. Microsoft PDF Printer does not.
The problem I am running into is there appears to be a change that occurred between 2016 to 2019 on how the SaveAs dialog box is populated from Inventor. In 2016 the SaveAs field was populated using Application.ActiveDocument.DisplayName . Which is easy enough to modify within VBA editor. However I could not get this to populate the same in Inventor2019. Through some testing and troubleshooting I have determined that Invnetor2019 uses some form of FileName to populate the field instead of DisplayName.
So far I have not found a way to modify the FileName to do what I want.
The code that is being used in Inventor 2016:
Does anyone have any way of confirming what I am seeing as far as Inventor's use of FileName vs DisplayName?
And if it indeed changed, is there a similar work around I can do that wouldn't involve creating a new file, saving the PDF, then deleting the file? This is what I theorized is my only option if my hypothesis is correct.
Thank you
A text version of the code:
'Removes .idw from file name
If Len(ThisApplication.ActiveDocument.DisplayName) = 10 Then
Dim OriginalDisplayNumber, MyStr
OriginalDisplayNumber = ThisApplication.ActiveDocument.DisplayName
MyStr = Left(OriginalDisplayNumber, 6)
EndIf
'Modifies the Display Name
ThisApplication.ActiveDocument.DisplayName = UserForm1.TextBox1.Value & "-" & MyStr & "-Sht" & oSheetCounter
'Submit the print.
oPrintMgr.RemoveLineWeights = True
oPrintMgr.SubmitPrint
ThisApplication.ActiveDocument.DisplayName = ""
Can't find what you're looking for? Ask the community or share your knowledge.