Quantcast
Channel: SolidWorks Tech Tips, Videos & Tutorials from Javelin » Macro
Viewing all articles
Browse latest Browse all 10

Why Don’t My Macros Work in SolidWorks 2013?

$
0
0

Starting in SolidWorks 2013, a new version of Micosoft Visual Basic for Applications has been introduced.  SolidWorks now uses VBA 7.1 rather than VBA 6.  This new VBA version supports 64-bit systems.  As a result, your old macros may not compile correctly with this change.

One example is Declare statements used in prior versions of SolidWorks.  These Declare statements must now be marked as safe using the “PtrSafe” attribute on 64-bit systems.

Also the “Long” variable for function arguments representing pointers will require the use of the “LongPtr” variable instead.

Please refer to the following Microsoft webpage for more information:

http://msdn.microsoft.com/en-us/library/office/gg264421.aspx

If you are using Win32 APIs, this new version also requires a change to the way you import these APIs.  Rather than making multiple versions of macros, you can use conditional compiler directorives (#If Then, #Else, #End If).  This will allow the macro to work in Solidworks 2012 or 2013 in either 32-bit or 64-bit environments.  For more details and examples, please see the following forum posts.  An active SolidWorks Subscription and Customer Portal account is required (http://www.javelin-tech.com/blog/2011/10/sw-customer-portal/).

https://forum.solidworks.com/docs/DOC-2241

https://forum.solidworks.com/docs/DOC-2141

The post Why Don’t My Macros Work in SolidWorks 2013? appeared first on SolidWorks Tech Tips, Videos & Tutorials from Javelin.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images