Building COM Add-ins for the Visual Basic EditorThis content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
By creating COM add-ins for the Microsoft® Visual Basic® Editor, you can customize your development environment and work with components in a Visual Basic for Applications (VBA) project from code. For example, you can build a code wizard that walks a programmer through a series of steps and then builds a procedure, or you can build a code analyzer that determines how many times and from where a procedure is called.
When you create a COM add-in for the Visual Basic Editor, it appears in all instances of the Visual Basic Editor. You cannot, for example, create a COM add-in that appears only in the Visual Basic Editor in Microsoft® Word; it will also appear in the Visual Basic Editor in Microsoft® Access, Microsoft® Excel, Microsoft® PowerPoint®, Microsoft® FrontPage®, and any other VBA host applications on the computer where the COM add-in DLL is registered.
Note also that you can create multiple add-ins in a single DLL. Each add-in designer in the Add-in project represents a separate add-in. For example, you can create a single DLL that contains a suite of add-ins for developers, and the developers can load just the add-ins they want to use.
To control the Visual Basic Editor from the code inside an add-in, you use the Microsoft Visual Basic for Applications Extensibility library. This object library contains objects that represent the parts of a VBA project, such as the VBProject object and the VBComponent object. The top-level object in the VBA Extensibility library object model is the VBE object, which represents the Visual Basic Editor itself. For more information about the object model, use the Object Browser.
Note Do not confuse the VBA Extensibility library with the IDTExtensibility2 library. Although their names are similar, the VBA Extensibility library provides objects that you can use to work with the Visual Basic Editor from an add-in while it is running, and the IDTExtensibility2 library provides events that are triggered when the add-in is connected or disconnected. In addition, do not confuse the VBA Extensibility library with the Microsoft Visual Basic 6.0 Extensibility library, which is used for creating add-ins in Microsoft Visual Basic.
Add-ins, Templates, Wizards, and Libraries | What Is a COM Add-in? | Building COM Add-ins for Office Applications | Creating COM Add-Ins in Office Developer | Creating a COM Add-in for the Visual Basic Editor | Building Application-Specific Add-ins | Creating Templates | Creating Wizards | Building Reusable Code Libraries