Visual Basic in SOLIDWORKS
SOLIDWORKS provides us two methods for open Visual Basic for Application.- Menu based method
- Toolbar method
Menu Base Method
To open VBA window, go "Tools" in the menu bar. Then go to "Macro". When you click "Macro" you found 5 options or button. (Menu bar ⇨ Tool ⇨ Macro)- Click "Tools" as shown below.
after clicking "Macro" below option appears
Description and working of each button will be given after next method.
Toolbar Method
To open VBA window, click “Right Mouse Button” anywhere on the screen. By doing this a list of all available "Toolbar" option appears. In this list, we need to select "Macro" toolbar to show the macro toolbar.
After clicking of Right Mouse Button below Toolbar list appears.
From this list, we need to select "Macro" option as shown below.
After clicking "Macro" option below toolbar appears.
Creating a macro is different from recording a macro. When you create a new macro, you program the macro directly from an editing application such as Visual Basic Editor. When you record a macro, you create the macro within the SOLIDWORKS software.
To create a new macro:
- Click New Macro (Macro toolbar), or click Tools ⇨ Macro ⇨ New
- Type a file name.
- Click Save.
Your macro editing application opens ready for you to program the new macro.
Record/Pause Macro Button
You can record operations performed with the SOLIDWORKS user interface and replay them with SOLIDWORKS macros. A macro contains equivalent API functions. These API functions were made when the operation was performed with the user interface.
A macro can record your mouse clicks, menu choices, and keystrokes to play back later.
To record a macro:
- Click Record/Pause Macro Button (Macro toolbar), or click Tools ⇨ Macro ⇨ Record.
- Perform the steps you want to record.
- When you are done, click Stop Macro (Macro toolbar), or click Tools ⇨ Macro ⇨ Stop.
- In the dialog box, type a name for the File and click Save. (The “.swp” extension is automatically added to the filename.)
You can run the macro from the Macro toolbar or Tools menu.
No comments:
Post a Comment