Partager via


Visual Basic Concepts

Add-In Troubleshooting

If you get an error when creating or activating your add-in, check the following:

  • Make sure that the add-in was created as an ActiveX DLL or ActiveX EXE project.

  • Make sure the add-in component is registered on the machine on which you are going to use it

    For more information about registering your add-in, see "Registering Add-Ins" in this chapter.

  • Make sure that Microsoft Visual Basic Extensibility is selected in the References dialog box. (In Visual Basic, click the Project menu, then click References.) This is because the VBIDE collection and VBA object are part of that type library. If it’s not active, references to extensibility (add-in) objects cannot be resolved properly, and you’ll get errors at compile time.

  • If your add-in uses command bars, make sure that Microsoft Office 8.0 Object Library is selected in the References dialog box. This gives your program access to the command bar objects, collections, properties, and events.

  • Make sure that the project name written to the Vbaddin.ini file add-in entry exactly matches the name of your project.

    You can view or set the project name by clicking the Project menu, then clicking project name Properties. Enter the project name in the Project Name box.

  • Make sure that the Name property of your class module that exposes the IDTExtensibility interface matches the name written to the Vbaddin.ini file entry.

  • Make sure that the Visual Basic run-time DLL and any other necessary files are on file paths that are available to your add-in. (This shouldn’t be an issue if you run the Visual Basic setup program.)

  • Make sure that your add-in’s class module contains procedures for the OnConnection, OnDisconnection, OnStartupComplete, and OnAddInsUpdate events. Add-ins require that these four event procedures be present, even if they contain only a comment. The procedures must contain at least one line of code, otherwise the compiler will remove the empty procedures from the class module, and the add-in will not work correctly.