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 Macro button to any toolbar in the SolidWorks window.

  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: VSTA Requires Microsoft .NET Framework 3.5.

  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 again to close the Customize dialog box.

To edit a macro button:

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

  2. Right-click the macro button in the toolbar that you want to edit and select Properties.

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

  4. Click OK again to close the Customize dialog.

To delete a macro button:

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

  2. Right-click the macro button in the toolbar that you want to edit and select Delete.

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