Programming VBA and VSTA macros using SOLIDWORKS API


Macros are script-like applications which can be executed and edited directly within SOLIDWORKS environment.

Macros leverage SOLIDWORKS API and 3rd party components API (such as Excel or File System) to compliment the SOLIDWORKS functionality. In most of cases macros are used as an automation scripts to enhance the repetitive task.

There are thousands of macros available for download from various resources such as official SOLIDWORKS Forum or CodeStack 'Goodies'

There are 2 main categories of macros supported by SOLIDWORKS: VSTA and VBA macros. Please refer the Macro Types article for more details.

Macro toolbar
Macro toolbar

Macro toolbar provides commands for

The above commands are also available from the menu.

Macro menu
Macro menu

As macros are usually used in the production environment it is vital to be able to debug and troubleshoot the macro to ensure the quality. Please refer the Macros Troubleshooting for the explanations and resolutions for the most common errors in macros.

Product of Xarial Product of Xarial