PDF creator Macro difficulties converting from Inventor 2016 to 2019

PDF creator Macro difficulties converting from Inventor 2016 to 2019

Nosneros
Explorer Explorer
355 Views
1 Reply
Message 1 of 2

PDF creator Macro difficulties converting from Inventor 2016 to 2019

Nosneros
Explorer
Explorer

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:

VBA Screen shot.JPG


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

0 Likes
356 Views
1 Reply
Reply (1)
Message 2 of 2

Nosneros
Explorer
Explorer

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 = ""

0 Likes