30.04.2017 Views

4523756273

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 21: Creating Excel Add-Ins<br />

357<br />

4. In the Comments field, enter a description.<br />

This information appears at the bottom of the Add-Ins dialog box when<br />

the add-in is selected. For this example, enter Changes the case of text in<br />

selected cells. Access this utility by using the right-click shortcut menu.<br />

Protecting the VBA code<br />

If you want to add a password to prevent others from viewing the VBA code,<br />

follow these steps:<br />

1. Activate the VBE and select the change case.xlsm workbook in the<br />

Project window.<br />

2. Choose Tools➪VBAProject Properties and click the Protection tab on<br />

the dialog box that appears.<br />

3. Select the Lock Project for Viewing check box and enter a password<br />

(twice).<br />

4. Click OK.<br />

5. Save the workbook by choosing File➪Save from the VBE’s menu or by<br />

going back to the Excel window and choosing File➪Save.<br />

Creating the add-in<br />

At this point, you’ve tested the change case.xlsm file, and it’s working correctly.<br />

The next step is to create the add-in:<br />

1. If needed, reactivate Excel.<br />

2. Activate the change case.xlsm workbook and choose File➪Save As.<br />

Excel displays its Save As dialog box.<br />

3. In the Save as Type drop-down menu, select Add-In (*.xlam).<br />

4. Specify the location and click Save.<br />

A new add-in file (with an XLAM extension) is created, and the original XLSM<br />

version remains open.<br />

Opening the add-in<br />

To avoid confusion, close the XLSM workbook before opening the add-in that<br />

you created from that workbook.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!