Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Run a Vba Macro after Save Document

Anonymous

Run a Vba Macro after Save Document

Anonymous
Not applicable

Hello, fellows,

 

My issue this time is:

How can I run a VBA macro after Save my Opened Document?

I mean, How can I run a VBA macro when I'm saving an Opened Document?

 

Thanks!

0 Likes
Reply
Accepted solutions (1)
1,921 Views
5 Replies
Replies (5)

bjweix
Explorer
Explorer

The auto VBA macros are deprecated, you can use iLogic event trigger instead.

0 Likes

dano0310
Advocate
Advocate

Hi,

 

As mentioned above use an event trigger to run an iLogic rule which then runs a macro.

 

 

InventorVb.RunMacro("ApplicationProject", ModuleName, MacroName)

 The first item doesn't necessarily have to be the application project if the macro is within the part.

 

Regards Dan

0 Likes

Anonymous
Not applicable
Accepted solution

Ok! I got there.

I have many files, so I need a way to run the rule 

InventorVb.RunMacro("ApplicationProject", ModuleName, MacroName)

with the event trigger "Run this rule - After Save Document" automatically, with no need to do the same task to each file. I say this also because of the other users of our net, that they don't need to remember the task.

I would like to get the Event Trigger automatically too.

smilinger
Advisor
Advisor

Try search "Code Injector" in the forum, which can be used to set event triggers for lots of files in batch.

0 Likes

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

In the long term it can be a real problem keeping track of which document is running what code and modify any of them if necessary - e.g. to change the logic in it. The best would be to go with addin's as pointed out here: 

http://modthemachine.typepad.com/my_weblog/2008/09/vba-document-projects.html

 

Cheers,



Adam Nagy
Autodesk Platform Services