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

Run a Vba Macro after Save Document

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!

bjweix
in reply to: Anonymous

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

dano0310
in reply to: Anonymous

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

Anonymous
in reply to: dano0310

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
in reply to: Anonymous

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

adam.nagy
in reply to: Anonymous

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