Message 1 of 3
VBA Code Autodesk Inventor... Help?
Not applicable
08-07-2012
09:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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:
- 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'.
- 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)
- The next step would be for the excel file to automatically save itself.
- 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.