SOLIDWORKS Macro Troubleshooting: Issues and Resolutions
An overview of common errors and solutions when running macros in SOLIDWORKS labels: [macro, not working, issues, solidworks api, troubleshooting, vba] styles:
- /_assets/styles/catalogue.css redirect-from:
- /2018/04/macros-troubleshooting-issues-and-resolutions.html
SOLIDWORKS macros are the most common way to automate and extend SOLIDWORKS functionality using its API. Macros can be developed internally within a company or downloaded from various websites, including the SOLIDWORKS forum, 3D Content Central, CodeStack, and even recorded within SOLIDWORKS.
However, there are cases where macros do not work as expected. This can often be one of the following scenarios:
- A macro that was previously working suddenly stops working.
- A macro works on some workstations but not on others.
- A macro works fine on certain models but not on others.
In this article, I will outline the most common symptoms of errors in macros.
Browse the list of errors to find the most common solutions.
Click on the links to get a detailed description, cause, and steps to resolve the issue.
List of Errors
Run-time error '91': Object variable or With block variable not set
Compilation error: Can't find project or library
Run-time error '424': Object required
Run-time error '13': Type mismatch
Compilation error: Undefined type
Run-time error '438': Object doesn't support this property or method
Run-time error '429': ActiveX component can't create object
Run-time error '5': Invalid procedure call or argument
Compilation error: "This code must be updated to work on 64-bit systems. Please review and update Declare statements and then mark them with the PtrSafe attribute."
Unable to open (applies to VBA macros)
Compilation error: Invalid outside procedure error
SolidWorksMacro does not contain a definition for 'swApp' (VSTA)
Unable to open (applies to VSTA macros)
{% catalogue { type: sw-macro-fix } %}