Excel 2019 Bible

(singke) #1

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:


  1. In Excel, choose Developer ➪ Code ➪ Macros (or press Alt+F8). The Macro dialog
    box appears.

  2. In the Macro Name list, select the macro named ShowChangeCaseUserForm.

  3. Click the Options button. The Macro Options dialog box appears.

  4. Specify Ctrl+Shift+C as the shortcut key and click OK.

  5. 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:


  1. Activate the VBE.

  2. In the Project window, click the project.

  3. Choose Tools ➪ Properties. The VBE displays its Project Properties
    dialog box.

  4. Select the Protection tab (as shown in Figure 48.5).


FIGURE 48.5
The Protection tab of the Project Properties dialog box
Free download pdf