Debugging a COM Add-in
When you are developing a COM add-in in Microsoft® Visual Basic® for Applications (VBA), you can debug the add-in by putting the project into run mode. With the project in run mode, you can load and use the COM add-in from within a Microsoft® Office XP application to test and debug it by using any of the Visual Basic debugging tools.
To debug a COM add-in in the Visual Basic Editor
- Open the Add-in project in Visual Basic Editor.
- Place any desired breakpoints, Stop statements, or watches in the code.
- On the Run menu, click Run Project. This compiles your project, alerting you to any compilation errors, and then puts the project into run mode.
- Open the intended host application for the COM add-in. If you have set the add-in's load behavior to Startup or Load at Next Startup Only, the add-in loads as soon as you start the application. If the add-in's load behavior is set to None or Load on Demand, open the COM Add-ins dialog box, and select the check box next to your add-in to load it.
When the add-in loads, the OnConnection event occurs. You can now enter break mode in the Add-in project in the Visual Basic Editor and debug the code.
See Also
Building COM Add-ins for Office Applications | Working with Add-in Designers | Specifying Load Behavior | Writing Code in the Add-in Designer | Hooking a COM Add-in Up to a Command Bar Control | Making the DLL | Distributing COM Add-ins | COM Add-ins and Security