Assign SOLIDWORKS Macro to Button
When you create a SOLIDWORKS macro, you can assign a bitmap to a macro
button on a SOLIDWORKS toolbar. The SOLIDWORKS software includes sample
bitmaps, or you can create your own bitmap. If you create a bitmap for
a macro button, the bitmap must meet these requirements:
To assign a macro to a button:
With a document open, click Tools
> Customize.
In the dialog box, on the Commands
tab:
Select Macro
in Categories.
Under Buttons,
drag the Macro
button
to any toolbar in the SOLIDWORKS window.
In the Customize
Macro Button
dialog box:
Under Appearance:
Click Choose
Image.
In the Icon
path dialog box, select a bitmap image (*.bmp),
then click Open.
NOTE: The SOLIDWORKS software provides bitmap images to use as custom
buttons. These are located in install_dir/data/user
macro icons. Select Thumbnail
to see the image in the Icon
path dialog box.
Type a Tooltip
and Prompt message, which should
provide a brief description of the function of the tool on the status
bar. Both the ToolTip and message are displayed when the pointer is on
the bitmap.
Under Action:
Click
and navigate to the
folder where the macro is stored.
In the Macro Path dialog:
Select SW
VBA Macros (*.swp) if adding a VBA macro (selected by default).
- or -
Select SW VSTA Macros (*.dll) if
adding a VB.NET or C# macro.
NOTE:
VSTA Requires Microsoft .NET
Framework 3.5.
Select the macro.
Click Open.
Select the macro that you want to assign
to the button.
Click Open.
Click OK.
Click OK
to close the Customize dialog
box.
To edit a macro button on a toolbar or the CommandManager tab:
In an open SOLIDWORKS document, click Tools
> Customize.
If the macro button is on the CommandManager tab, right-click the macro button that
you want to edit and select Properties.
-
If the macro button is on a toolbar, right-click the macro button.
In the Customize
Macro Button dialog, edit the macro button's properties and click OK.
Click OK
to close the Customize dialog.
To delete a macro button from a toolbar or the CommandManager tab:
In an open SOLIDWORKS document, click Tools
> Customize.
If the macro button is on the CommandManager tab, right-click the macro button that
you want to edit and select Delete.
-
If the macro button is on a toolbar, drag and drop the macro button to
the graphics area or the Recycle Bin.
Click OK
to close the Customize dialog.
For more information about assigning macros to toolbars, see SOLIDWORKS
Help.