Chapter 32. Creating and Using Macros


  • Recording macros

  • Creating a macro with a user form

  • Finding macro help

Macros can be an important source of productivity enhancements that are not offered directly by SolidWorks software. Being able to create your own macros can make you more valuable at your place of work. Macros can do anything from centering a rectangle on the Origin, to setting all face colors back to the part color, to changing the decimal places of a selected dimension, to creating a spline from an equation. You do not have to be a programmer to follow the information in this chapter. However, you should have a general understanding of Visual Basic.

Visual Basic is a common programming language. Visual Basic for Applications, or VBA, is included in SolidWorks in the same way that it is included in Word and Excel. If you have programming skills with these other common applications, then those skills are largely transferable to working with SolidWorks macros.

Application Programming Interface, or API, refers to the available SolidWorks functions that can be called programmatically (numbered in the hundreds) from VB, VBA, VB.NET, C++, C# (c sharp), or macro files that have the filename extension of *.swp or *.swb.


The *.swb filename extension type is a legacy macro. You can edit and save these files into the newer SWP format, or you can run them as they are. Also keep in mind that *.swp is the filename extension that is used by the Windows Swap file.

This chapter ...

Get SolidWorks® 2007 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.