Excel 2010 Bible

(National Geographic (Little) Kids) #1

Part VI: Programming Excel with VBA


908


Note
You can continue to modify the macros and UserForms in the XLAM version of your file. Because the add-in
doesn’t appear in the Excel window, you save your changes in the VB Editor by choosing File ➪ Save. n


An Add-In Example


This section discusses the steps to create a useful add-in from the change case.xlsm workbook
I cover in Chapter 41. This workbook contains a UserForm that displays options that change the
text case of selected cells (uppercase, lowercase, or proper case). Figure 45.2 shows the add-in in
action.

FIGURE 45.2

This dialog box enables the user to change the case of text in the selected cells.


On the CD
This file is available on the companion CD-ROM and is named change case.xlam. The file is not locked, so
you have full access to the VBA code and UserForm. n


Setting up the workbook

This workbook contains one worksheet, which is empty. Although the worksheet is not used, it
must be present because every workbook must have at least one sheet.

Choose Insert ➪ Module in the VB Editor to insert a VBA module (named Module1). Choose
Insert ➪ UserForm to insert a UserForm (named UserForm1).
Free download pdf