Hide Table of Contents

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:

  • Dimension = 16 x 16 pixels

  • Color = 16 colors

  • Background color = white

To assign a macro to a button:

  1. With a document open, click Tools > Customize.

  2. In the dialog box, on the Commands tab:

    1. Select Macro in Categories.

    2. Under Buttons, drag the New Macro Button to any toolbar or the CommandManager in SOLIDWORKS.

  3. In the Customize Macro Button dialog box:

    1. Under Appearance:

  1. Click Choose Image.

  2. 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.

  3. 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.

    1. Under Action:

      1. Click and navigate to the folder where the macro is stored.

      2. In the Macro Path dialog:

  1. 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: SOLIDWORKS 2018 offers Visual Studio Tools for Applications (VSTA), impacting how you develop and run VB.NET and C# macros in SOLIDWORKS 2018 and later.

  2. Select the macro.

  3. Click Open.

      1. Select the macro that you want to assign to the button.

      2. Click Open.

    1. Click OK.

  1. Click OK to close the Customize dialog box.

To edit a macro button on a toolbar or CommandManager:

  1. In an open SOLIDWORKS document, click Tools > Customize.  

  2. If on a toolbar, right-click the macro button that you want to edit.

  3. If in CommandManager, right-click the macro button that you want to edit. Select Properties.

  4. In the Customize Macro Button dialog, edit the macro button and click OK.

  5. Click OK to close the Customize dialog.

To delete a macro button from a toolbar or CommandManager:

  1. In an open SOLIDWORKS document, click Tools > Customize.  

  2. If on a toolbar, drag and drop the macro button from the toolbar to the Recycle Bin.

  3. If in CommandManager, right-click the macro button that you want to delete. Select Delete.

  4. Click OK to close the Customize dialog.

 

For more information about assigning macros to toolbars, see SOLIDWORKS Help.



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Assign SOLIDWORKS Macro to Button
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2021 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.