Excel 2010 Bible

(National Geographic (Little) Kids) #1

Part VI: Programming Excel with VBA


912


FIGURE 45.5
The Project Properties dialog box.

Creating the add-in

To save the workbook as an add-in, switch to the Excel window and activate your workbook. Then
choose File ➪ Save As. Select Microsoft Excel Add-In (*.xlam) from the Save as Type drop-down
list. Enter a name for the add-in file and then click OK. By default, Excel saves the add-in in your
AddIns directory, but you can choose a different directory if you like.

Creating the user interface for your add-in macro

At this point, the add-in is created, but it’s missing one key component: a way to execute the
macro that displays the UserForm. Here are three ways to do this:

l (^) Customize your Quick Access toolbar (or the Ribbon) to include a new command. See
Chapter 23 for details.
l (^) Create an old-style (pre–Excel 2007) CommandButton. See the sidebar, “Modify the User
Interface the Old Way.”
l (^) Modify the add-in file so that it adds a new command to the Ribbon when the add-in is
opened. I discuss this topic briefly in Chapter 23, but complete details are beyond the
scope of this book.

Free download pdf