18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

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

Creating Custom Excel Add-Ins 45<br />

After you create the add-in, you need to install it:<br />

1. Choose <strong>Office</strong> ➪ Excel Options ➪ Add-Ins.<br />

2. Select Excel Add-Ins from the Manage drop-down list and click Go to display the Add-Ins<br />

dialog box.<br />

3. In the Add-Ins dialog box, click the Browse button to locate the XLAM file that you created,<br />

which installs the add-in. The Add-Ins dialog box uses the descriptive title that you provided in<br />

the Properties panel.<br />

You can continue to modify the macros and UserForms in the XLAM version of your file.<br />

Because the add-in doesn’t appear in the Excel window, you save your changes in the VB<br />

Editor by choosing <strong>Office</strong> ➪ Save.<br />

NOTE<br />

An Add-In Example<br />

This section discusses the steps to create a useful add-in from the change case.xlsm workbook I covered in<br />

Chapter 41. This workbook contains a UserForm that displays options that change the text case of selected<br />

cells (uppercase, lowercase, or proper case). Figure 45.2 shows the add-in in action.<br />

FIGURE 45.2<br />

This dialog box enables the user to change the case of text in the selected cells.<br />

ON the CD-ROM<br />

This file is available on the companion CD-ROM and is named change case.xlam. The file is<br />

not locked, so you have full access to the VBA code and UserForm.<br />

Setting up the workbook<br />

This workbook contains one worksheet, which is empty. Although the worksheet is not used, it must be<br />

present because every workbook must have at least one sheet.<br />

Choose Insert ➪ Module in the VB Editor to insert a VBA module (named Module1). Choose Insert ➪<br />

UserForm to insert a UserForm (named UserForm1).<br />

775

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

Saved successfully!

Ooh no, something went wrong!