VBA Code Autodesk Inventor... Help?

VBA Code Autodesk Inventor... Help?

Anonymous
Not applicable
777 Views
2 Replies
Message 1 of 3

VBA Code Autodesk Inventor... Help?

Anonymous
Not applicable

I’m kinda new to Macros and VBA in Autodesk Inventor. My code writing skills are kind of embarrassing and I would appreciate any help anyone can give me.

 

I guess I will start by explaining what I want to do:

  1. Open an embedded (3rd Party Excel) spreadsheet in Autodesk Inventor. When the embedded file is in inventor it’s called Embedding 5. After the file has been open the name changes to 'Worksheet in “file Name”.xls'.
  2. After the excel file has opened, I would like to run two separate macros that are embedded in the excel spreadsheet. The macros are called CreatePDFImperial and CreatePDFMetric. They make two separate PDF’s and files them in a specific location. The macros in excel run exactly the way they are supposed to. (If needed I can run the excel macros in excel when file is opened)
  3. The next step would be for the excel file to automatically save itself.
  4.  The last step is to close the excel file

 

My attempt at this code:

 

Sub OpenAndClose()

'

' OpenAndClose Macro

'

' Keyboard Shortcut: Ctrl+w

'

    Workbooks.Open FileName:= _

        GoExcel.Open("3rd Party:Embedding 5", "Sheet2")

    Application.Run "'Worksheet in TEST MO HDR.xls'!CreatePDFImperial"

    Application.Run "'Worksheet in TEST MO HDR.xls'!CreatePDFMetric"

    ActiveWorkbook.Save

    Workbooks.Close FileName:= _

        GoExcel.Close("3rd Party:Embedding 5", "Sheet2")

End Sub

 

Thanks to anyone that can take the time to point me in the right direction. 

0 Likes
778 Views
2 Replies
Replies (2)
Message 2 of 3

jletcher
Advisor
Advisor

Try this

 

 

ThisWorkbook.Close savechanges:=True

0 Likes
Message 3 of 3

jletcher
Advisor
Advisor

Or this not sure can't remember.

 

activeworkbook.Close SaveChanges:=True

0 Likes