Open PDF through Inventor VBA

Open PDF through Inventor VBA

eric.frissell26WKQ
Advocate Advocate
882 Views
5 Replies
Message 1 of 6

Open PDF through Inventor VBA

eric.frissell26WKQ
Advocate
Advocate

Hi, I'm working on a script to automate some basic tasks we have to do upon release of our assemblies and for the life of me I can't find any information on the call to open a file with adobe as everything is referencing Excel.  Lots of information for Workbooks.open(filepath) but nothing for Inventor.  I suppose there's a round about way of using Inventor to open Excel to create use the Workbooks.open but that seems like a lot of work.

 

Second once the pdf is open I'd like to access the Fill and Sign.  Any chance anyone knows the syntax for this?

 

Also, technically speaking, would the one line that opens Adobe be a reference, a call, a method, a formula?  Example OpenCF = Shell("Acrobat.exe ""CFDocPath""", vbNormalFocus).  Curious since I'm sure those words get mixed up a lot and VBA isn't taught in mechanical courses.

0 Likes
Accepted solutions (2)
883 Views
5 Replies
Replies (5)
Message 2 of 6

pcrawley
Advisor
Advisor

iLogic:

ThisDoc.Launch(pdfPath & "\" & pdfFilename)

As for your second question - no idea sorry! 

Peter
0 Likes
Message 3 of 6

eric.frissell26WKQ
Advocate
Advocate

@pcrawley Ah, it looks so close, I'm looking for the VBA version.... but it might put me down the right avenue to throw references to a Document.Open and see if it sticks.  Thanks!

0 Likes
Message 4 of 6

A.Acheson
Mentor
Mentor
Accepted solution

Here is a nice simple example that should work. Contacting the pdf application and making changes is a whole different ball game. Some deep diving on stack overflow might yield something fruitful. 

Function OpenAnyFile(strPath As String)
  Set objShell = CreateObject("Shell.Application")
  objShell.Open(strPath)
End Function

Sub Test()
  Dim pdfPath as String
  pdfPath = "C:\example.pdf"
  Call OpenAnyFile(pdfPath)
End Sub

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 6

pball
Mentor
Mentor
Accepted solution

This is what I used to open pdfs/dwgs when I still used VBA. Should open any file you can double click in explorer to open. To access the fill and sign I have no idea about that.

Dim myShell As Object
Set myShell = CreateObject("WScript.Shell")
myShell.Run "C:\Misc\Vault2022.jpg"

Check out my style edits for the Autodesk forums
pball's Autodesk Forum Style
0 Likes
Message 6 of 6

eric.frissell26WKQ
Advocate
Advocate

Thanks @A.Acheson and @pball , you guys nailed it.  I found roughly the same thing this morning as well, I was able to use 

    Else
        Dim CFpdf As Object
        Set CFpdf = CreateObject("Shell.Application")
        Shex.Open (CFDocPath)

and get it to open

 

Fun part number 2 will be getting it to use the Fill and Sign...

 

Thanks for the help!

0 Likes