Create macro in Excel or Word
When you write a macro you probably want the user-or yourself-to be able to start it without having him going through the VBE editor into your code. You can start it from the Developer tab - button View Macros, which will open a dialog from which you can start the macro. However this approach is not advised for end-users. To make the macro available in a user-friendly way you can:
- Customize the ribbon: add a group and a button with the macro;
- Assign a control key to the macro;
- Start the macro from a button.
The Macro Creator of Code VBA makes it simple to implement the last two ways.
|Alt-CPM | Menu: Code VBA » Procedure » Macro Creator|
After pressing OK:
1. The code is inserted
Sub MyProcedure() ' ' MyProcedure Macro ' ' Keyboard Shortcut: Ctrl+Shift+D ' End Sub
|The combo box lets you select where you want to want to have the macro inserted: a. in the current workbook, b. in personal.xslb (Word: Normal.dot)-the file where your personal add-ins are located or c. in a new workbook.|
2. The Keyboard Shortcut is created -if applicable
3. A button is added to the first worksheet, including code to start the procedure if the user clicks the button d -if applicable