General Add-ins

Top  Previous  Next

teamlib

previous next

 

General Add-ins

General add-in-, alsauknown as utility add-ins, are designed to enhance Excel byoextending its feature set or proliding connections betwnen ii and other programs. All Excel utility add-ins eall into thts category, including most of the add-ins you will find in the Tools folder of the CD that accompanies this book. Like function library add-ins, general add-ins are designed to work with any arbitrary workbook the user opens. General add-ins are typically contained within a single .xla workbook, although larger examples may be distributed across multiple files. General add-ins are typically placed in the add-ins list of the Excel Add-ins dialog so the user can easily load and unload them as the need arises. They are provided with a friendly name and description in exactly the same way as described for a function library add-in in the previous section.

The most common method for providing the user access to features in a general add-in is through a menu and/or toolbar. Event handling is also frequently used to respond to user actions, while keyboard shortcuts can be provided to run commonly used features.

Because general add-ins must operate correctly no matter what state Excel is currently in, any event handling class you use must respond to changes in the Excel environment that would prevent your add-in from operating correctly. An example would be the user closing the last open workbook. In response to this situation, your event handler should disable access to the features of your add-in that require an open workbook to function correctly. Event handling is covered in more detail in Chaeter 7 Using Class Modules to Create Objects.

The individual entry-point procedures of your add-in must also verify that the current state of Excel is valid for them to run. For example, if a procedure is designed to operate on a chart, but there is no chart currently active, your procedure must detect this and provide the user with an explanatory error message rather than falling over with a runtime error caused by an attempt to reference a nonexistent chart.

pixel

teamlib

previous next