Inv 2014 Removes support for VBA auto-run Macros

Inv 2014 Removes support for VBA auto-run Macros

karthur1
Mentor Mentor
2,491 Views
9 Replies
Message 1 of 10

Inv 2014 Removes support for VBA auto-run Macros

karthur1
Mentor
Mentor

In the readme for Inventor 2014... I see this information:

 

Inventor 2014 removes support for VBA auto-run macros which are embedded in Inventor documents. These VBA macros are named: “AutoOpen”, “AutoNew”, “AutoSave”, “AutoClose” and “AutoEdit”. They can severely impact Inventor performance and pose a possible security risk. The suggested alternative to auto-run macros is to create an Inventor add-in.

 

I guess this is the reason that my macro (that uses Autosave) does not work any longer.  This is a real deal breaker for 2014 for me.  This macro is in EVERY idw that I create and it must work.  It has been working since Inventor R4.  The suggestion given is to create an Inventor Add-in.  I dont have clue how to convert this to an Inventor add-in.

 

Any takers on converting it for me?  Attached is the code.

 

Thanks

 

 

Accepted solutions (1)
2,492 Views
9 Replies
Replies (9)
Message 2 of 10

waynehelley
Collaborator
Collaborator

what about running the code from ilogic?

 

If the commands you are using are not possible to rewrite in ilogic, it is possible to trigger a VB Macro to run from ilogic.

 

Using 'Event Triggers' you can set the rule to run upto creating a document.

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
0 Likes
Message 3 of 10

karthur1
Mentor
Mentor
The code is embedded in my idw's. ilogic would be a solution for new idw's, but for existing legacy idw's, that is not a solution.
Not a solution because each idw would have to have the "before save" trigger set before it would run.
0 Likes
Message 4 of 10

Curtis_Waguespack
Consultant
Consultant

Hi  karthur1,

 

This tool might help:

http://beinginventive.typepad.com/being-inventive/2012/08/major-upgrade-to-the-ilogic-code-injector-...

 

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

EESignature

0 Likes
Message 5 of 10

karthur1
Mentor
Mentor

Curtis,

No use since this will not work with an external iLogic code.  I am looking at converting my code to an add-in.

 

Thanks

0 Likes
Message 6 of 10

waynehelley
Collaborator
Collaborator

from my experience with the code injector, I am fairly sure that there is an option to keep rules as internal rules after running the injector.

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
0 Likes
Message 7 of 10

waynehelley
Collaborator
Collaborator

Code Injector.png

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
0 Likes
Message 8 of 10

karthur1
Mentor
Mentor

I want to keep the the ilogic code as an external rule and the trigger should be set to "before save".  I will need to experiment and see if I can get the code injector to do that.

 

I dont see an option for external rules in your screen capture.

 

I still have an issue with all my legacy idw files... all the way back from Inv 4.  They are all in vault (1,000's of them).  I would have to search for them, get latest from vault, check them out, run this code injector, then check them back in.... pray that there are not hickups along the way.

0 Likes
Message 9 of 10

philippe.leefsma
Alumni
Alumni

Hi Karthur1,

 

It's been several years now that we've encouraged developers to move away from those auto macros, mentionning that they will be removed at some point. Converting your VBA code to Vb.Net would be a matter of minutes.

 

We've been publishing numerous resources to help you achieve the migration VBA to .Net addins:

 

http://modthemachine.typepad.com/my_weblog/2008/10/converting-vba-auto-macros-to-an-add-in.html

 

http://download.autodesk.com/media/adn/VBA_Migration/DevTV_Recording/VBA_Migration.html

 

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=770215

 

I hope it helps.

 

Best Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Message 10 of 10

karthur1
Mentor
Mentor
Accepted solution

Thanks Wayne Brill so converting this for me.  Works great!!

 

You can find Waynes blog here about the addin that he wrote. 

 

It is also attached here just in case the link gets broken in the future.

0 Likes