Microsoft Office 2000/Visual Basic Programmer's Guide |
A COM add-in has events that you can use to run code when the add-in is loaded or unloaded, or when the host application has finished starting up or shutting down. In order to use these events, you must implement the IDTExtensibility2 library, which provides a programming interface for integrating COM add-ins with their host applications. When you implement the IDTExtensibility2 library within a class module, the library makes a set of new events available to the module. These are the events that you need to control your COM add-in.
If you've created your add-in project from the template, the IDTExtensibility2 library has already been implemented for you in the add-in designer's class module. If you're creating the COM add-in from scratch, use the following procedure.
To manually implement the IDTExtensibility2 library in Visual Basic 6.0
Implements IDTExtensibility2
Important You must include the event procedure stub for each event provided by the IDTExtensibility2 interface. If you omit any of the event procedures, your project will not compile. If you're not adding code to an event procedure stub, it's a good idea to add a comment; a single apostrophe (') is sufficient.
For more information about the Implements keyword and implementing libraries in a class module, see Chapter 9, "Custom Classes and Objects."