Recording and Playing Macros
Macros are scripts that let you run operations in the SOLIDWORKS software automatically.
You can create a macro and program it outside of the SOLIDWORKS software, or you can record a macro that captures a sequence of actions and commands as you perform them in the SOLIDWORKS software.
You can run a macro from the Macro toolbar or the Tools menu.
New Macro
You can create a new macro from the Macro toolbar or the Tools menu and then program the macro in a macro editing application.
Creating a new macro is different from recording a macro. When you create a new macro, you program the macro directly from a macro editing application such as Microsoft Visual Basic. When you record a macro, you create the macro from within the SOLIDWORKS software.
To create a new macro:
Record/Pause Macro
You can record operations performed with the SOLIDWORKS user interface and replay them with SOLIDWORKS macros.
A macro contains the equivalent calls to the API functions that were made when the operations were performed with the user interface. A macro can record your mouse clicks, menu choices, and keystrokes to play back later.
To record a macro:
Run Macro
You can run a macro from the Macro toolbar or the Tools menu.
To run a macro:
Edit Macro
You can edit or debug a macro that you recorded previously.
To edit a macro:
VBA
Visual Basic for Applications (VBA) is the engine that records, runs, or edits macros in SOLIDWORKS. Recorded macros are saved as .swp VBA project files.
You can read and edit .swb and .swp (VBA) files with the VBA editor. When you edit an existing .swb file, the file automatically converts into a .swp file. You can export a module to a file that you can use in other VB projects.
You can use VBA to create forms and to provide more user interaction with your recorded macros. For more information on VBA, see the Help menu in the VBA editor.
Macro Feature Files
Macro feature files create application-defined features that you can add to a SOLIDWORKS model. Their effect on the model is defined by custom programs that you or a third-party software developer supplies.
For more information on macro feature files, see the SOLIDWORKS API Help.