Macro Code in Autodesk Inventor?

Macro Code in Autodesk Inventor?

Anonymous
Not applicable
842 Views
2 Replies
Message 1 of 3

Macro Code in Autodesk Inventor?

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
843 Views
2 Replies
Replies (2)
Message 2 of 3

Curtis_W
Consultant
Consultant

Hi jddickson,

 

You can post and search for customization code here:

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 3 of 3

VinodBalasubramanian
Autodesk Support
Autodesk Support

Hi Dickson,

 

I have moved this thread to Inventor customization forum. This is the appropriate place to get answers on customizing Inventor with macros.

 

Hope it helps. Do let us know, if you have any concern.



Vinod Balasubramanian
AutoCAD Industry Support & Escalation Lead

0 Likes