Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Moving from 2012 to 2014, VBA Compile Error.

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
shastu
1634 Views, 6 Replies

Moving from 2012 to 2014, VBA Compile Error.

I just upgraded Inventor from 2012 to 2014.  Now when I try to run any of my macros, I get a "Microsoft Visual Basic for Applicaitons" dialog box that reads:  "Compile Error:  The code in this project must be updated for use on 64-bit systems.  Please review and update Declare statements and then mark them with the PtrSafe attribute."  This must be a bogus error because I did not go from a 32 bit system to a 64 bit system.  I was on a 64 bit system with 2012.  All I did was upgrade Inventor from 2012 to 2014.

6 REPLIES 6
Message 2 of 7
MegaJerk
in reply to: shastu

While I am not certain about what is causing your problem (perhaps you could post some simple problematic code for us) I do know that Inventor 2012, while it may be installed 64bit, has integration to the VBA environment that is 32bit only. It is for this reason why when you start up VBA (or call anything VBA related) an intermediary process ‘InventorHost32bit’ is launched and runs along side everything.




If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
Message 3 of 7
mrattray
in reply to: MegaJerk

VBA in 2014 was upgraded to run natively in 64 bit (VBA 6 to 7?). As a result all your macros must be updated to use native 64 bit calls. Architecture sensitive functions aren't common, but I did hit this problem myself. The fix was pretty simple. Post your code here and we'll see if we can give it a tweak.
By the way, there's lots of programming information on the Inventor Customization board. It's usually better to post and search there for programming stuff.
Mike (not Matt) Rattray

Message 4 of 7
shastu
in reply to: mrattray

Below is what it seems to have a problem with:

 

Public Declare Function GetSaveFileName Lib _ "comdlg32.dll" Alias "GetSaveFileNameA" _ (pOpenfilename As OPENFILENAME) As Long

Public Declare Function GetOpenFileName Lib _ "comdlg32.dll" Alias "GetOpenFileNameA" _ (pOpenfilename As OPENFILENAME) As Long

Message 5 of 7
shastu
in reply to: shastu

I went ahead and just put PtrSafe inbetween Declare and Function in both spots and it seems to work now.  Didn't think it would be that easy.  Is there anything else I should have done?

Message 6 of 7
Curtis_Waguespack
in reply to: shastu

Hi shastu,

 

You might search on the Inventor Customization forum, where VBA questions are more likely to have been asked & answered in the past:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

 Here are a couple of links that seems related (I just took a quick glance):

http://forums.autodesk.com/t5/Inventor-Customization/Inventor-2014-64-bit-breaks-database-connection...

http://forums.autodesk.com/t5/Inventor-Customization/MacroControlDefinition-does-not-work-in-2014/m-...

 

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

Message 7 of 7
mrattray
in reply to: shastu

If it works, it works.
Mike (not Matt) Rattray

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report