次の方法で共有


Building COM Add-ins for Office Applications

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.

COM add-ins aren't difficult to create, but there are several steps involved. The following sections outline these steps.

What You Need

To create a COM add-in, you need either of the following:

  • Visual Basic 5.0 or later

  • Office 2000 Developer

Office 2000 Developer provides a template project, COM Add-In.vbp, for creating a COM add-in in Visual Basic 6.0. This template project is available in the ODETools\V9\Samples\OPG\Samples\CH11\VB_COM_AddIn subfolder on the Office 2000 Developer CD-ROM. The template project supplies the files you need to create a COM add-in, as well as the code that forms the basis of any add-in.

The COM Add-In.vbp provides you with the following:

  • An add-in designer. An add-in designer is a component that helps you to create and register a COM add-in. You can modify an add-in designer to create your COM add-in and hook it into an application's user interface. For more information about add-in designers, see "Working with Add-in Designers" later in this chapter.

  • A reference to the IDTExtensibility2 type library. The Visual Basic 6.0 template project sets a reference to this type library, contained in the file Msaddndr.dll. The IDTExtensibility2 library supplies the events you can use to run code when your add-in is connected to or disconnected from the hosting application.

Note   This chapter focuses on creating COM add-ins in Visual Basic 6.0. The process of creating COM add-ins in Visual Basic 5.0 or with Office 2000 Developer differs in several ways that may not be fully in this chapter. For more information about creating add-ins in Visual Basic 5.0, see the documentation for Visual Basic 5.0. For more information about creating COM add-ins with Office 2000 Developer, see .