Part VI: Automating Excel
Creating the user interface for your add-in macro
At this point, the future add-in is missing one key component: a way to execute the macro
that displays the UserForm. The easiest solution is to provide a shortcut key that executes
the macro. Ctrl+Shift+C is a good key combination. Here’s how to do it:
- In Excel, choose Developer ➪ Code ➪ Macros (or press Alt+F8). The Macro dialog
box appears.
- In the Macro Name list, select the macro named ShowChangeCaseUserForm.
- Click the Options button. The Macro Options dialog box appears.
- Specify Ctrl+Shift+C as the shortcut key and click OK.
- Click Cancel to close the Macro dialog box.
Make sure you save the workbook after making this change.
Protecting the project
In some situations (such as a commercial product), you may want to protect your project so
that others can’t see the source code. To protect the project, follow these steps:
- Activate the VBE.
- In the Project window, click the project.
- Choose Tools ➪ Properties. The VBE displays its Project Properties
dialog box.
- Select the Protection tab (as shown in Figure 48.5).
FIGURE 48.5
The Protection tab of the Project Properties dialog box