Visual Basic Extensibility Reference

IDTExtensibility Interface

See Also Example Properties Methods Events

The IDTExtensibility interface contains methods that Visual Basic calls when an add-in is connected to it, whether through the Add-In Manager, or some other manner.

The IDTExtensibility interface contains pre-configured procedure templates (which includes their parameter lists) that you need to manage add-ins in Visual Basic.


Implements IDTExtensiblity


The usage of interfaces was introduced in Visual Basic 5.0. Interfaces enable you to choose a pre-configured procedure template from a module's Procedure drop down list, eliminating parameter list entry errors and allowing you to program your applications a bit faster.

An interface's methods are exposed through the Implements statement. When the above syntax is entered in the Declarations section of the Class module that handles an add-in's events, the interface's methods become available for your use through the module's Procedure and Object drop down boxes. To add the code to the module, simply select it from the drop down box.

The IDTExtensiblity interface currently contains four methods:

While these are methods to the IDTExtensibility interface, to you as a Visual Basic programmer, though, they act and behave like events. In other words, when an add-in is connected to Visual Basic, the OnConnection method is called automatically, similar to an event firing. When it is disconnected, the OnDisconnection method is called automatically, and so forth.

*Important* Since an interface is a contract between an object and Visual Basic, you must be sure to implement all of the methods in the interface. This means that all four IDTExtensibility interface methods are present in your Class module, each containing at least one executable statement. This can consist of as little as a single remark statement, but they must each contain at least one executable statement to prevent the compiler from removing them as empty procedures.