Microsoft Office 2000/Visual Basic Programmer's Guide   

Deploying COM Add-ins

If you've built a COM add-in using Visual Basic 6.0 or Office 2000 Developer, you can create an installation program for it by using the Package and Deployment Wizard included in either Visual Basic 6.0 or Office 2000 Developer. The two wizards are very similar. The installation program needs to deploy the COM add-in dynamic-link library (DLL) as well as any files on which it is dependent, such as type libraries that may not be on users' computers.

A COM add-in DLL created with the add-in designer in Visual Basic 6.0 or Office 2000 Developer is a self-registering DLL, meaning that it will register itself properly when the setup program runs. Once the DLL has registered itself, the COM add-in will appear in the list of available COM add-ins in the COM Add-ins dialog box. Therefore, it doesn't matter where you install the DLL, but for the sake of consistency you may want to choose one folder for installing all COM add-ins, such as the AddIns folder under C:\Windows\Application Data\Microsoft or C:\Windows\Profiles\UserName\Application Data\Microsoft.

If you create a COM add-in with Visual Basic 5.0, the COM add-in DLL is not a self-registering DLL, and you must register it on installation. If you don't have the Package and Deployment Wizard available to you, the easiest approach is to write a simple custom installation program to copy the DLL to users' machines and register it. You can use the Visual Basic 6.0 template project included in the ODETools\V9\Samples\OPG\Samples\CH02\CustomInstaller subfolder on the Office 2000 Developer CD-ROM to create a setup program to register a COM add-in built in Visual Basic 5.0. If you don't have Visual Basic 6.0, import the modules in the template project into a Visual Basic 5.0 project.

A more complicated option is to use the Visual Basic 5.0 Setup Toolkit to modify the Setup1.vbp project, add code to register the DLL, and recompile the Setup1.exe file. For more information about how to do this, see the documentation for Visual Basic 5.0.

For more information about COM add-ins, see Chapter 11, "Add-ins, Templates, Wizards, and Libraries."