Share via


Creating COM Add-ins in Office Developer

This 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.

You can create your own COM add-ins in Microsoft® Visual Basic® for Applications (VBA) with Microsoft® Office XP Developer. You do not require external development tools, such as Microsoft®Visual C++® or Microsoft®Visual Basic®, to create COM add-ins.

You can use Add-In Designers to create COM add-ins for use in VBA or any Office application. For example, you might create an add-in tool to format and print code that could be shared with other developers, or you might create an add-in for Microsoft® Excel to calculate tax rates that could be shared with Office users.

COM add-ins created with Office Developer are packaged as dynamic link libraries (DLL files) and are registered so that they can be loaded by Office XP applications.

To add an Add-In Designer to your project

  1. From the File menu, select New Project.

  2. In the New Project dialog box, select Add-In Project.

    An Add-In Designer will be added to your project.

The Add-In Designer provides several properties that can be set to define the attributes of your add-in, including Name, Description, and Load Behavior. It also provides several events that can be used to add code, such as OnConnection, OnStartupComplete, and OnDisconnection.

The actual code for your COM add-in depends on what you want the add-in to do, as well as which application the add-in is for. Each of the applications that can use COM add-ins exposes its extensibility structure using its object model; you can view the object model for your particular application in the Object Browser.

To package the COM add-in as a DLL in VBA

After you have written and debugged your code, you can make your add-in into a DLL.

  • From the File menu, select Make projectname.dll.

    **Note   **This will create the COM add-in, add the appropriate registry entries, and make the COM add-in available for use in your Office host.

See Also

Building COM Add-ins for the Visual Basic Editor | Creating a COM Add-in for the Visual Basic Editor