Run a Vba Macro after Save Document

Run a Vba Macro after Save Document

Anonymous
Not applicable
2,067 Views
5 Replies
Message 1 of 6

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
Accepted solutions (1)
2,068 Views
5 Replies
Replies (5)
Message 2 of 6

bjweix
Explorer
Explorer

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

0 Likes
Message 3 of 6

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
Message 4 of 6

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.

Message 5 of 6

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
Message 6 of 6

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