“I installed my Office solution (VSTO add-in) successfully but when I open the Office application, my add-in does not load. What is the problem?”
This is a common question which I came across many times in Forums. Here are simple and quick checks that you can do before you start scratching your head or jump to the Forums. I’ll be using Excel as the Office application, but the approach is applicable to others more or less.
1. Make sure your add-in is installed correctly and it is enabled
Open registry editor and navigate to “HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins”. Here is how this registry key looks like after I installed MyExcelAddin:
The registry string we are interested in the most is the LoadBehavior. Whenever you see "3" (Loaded at Startup) as the value of this string you are good in this part and your add-in tries to load when the Excel starts. For more information about registry entries for application-level Office solutions see this article.
2. Check out “COM Add-Ins” dialog in Excel
Now open Excel and see if your add-in loads successfully. If not, open Excel Options dialog (File->Options) and navigate to Add-Ins tab.
“Healthy add-ins” show up as “Active Application Add-ins”, however, if an add-in is disabled for whatever reason, it will appear under the “Inactive Application Add-ins”. You can select the “COM Add-ins” from the Manage dropdown at the bottom of this dialog and see the LoadBehavior of all COM add-ins. In normal cases, the add-in should be checked and its "Load Behavior" should be “Loaded at Startup”:
If the VSTO runtime encounters a problem loading the add-in, you’ll see this message instead.
“Load Behavior: Not Loaded. A runtime error occurred during the loading of the COM Add-in”.
3. Find the problem
Set the "VSTO_SUPPRESSDISPLAYALERTS" environment variable to 0. Then go back to the registry key I mentioned in step 1 and set the LoadBehavior to 3. Now restart the Excel. You should be able to see a dialog describing what is happening:
It is also a good practice to enclose the code inside the add-in's startup event in a try-catch block and log all exceptions.
4. Hard disabled add-ins
If an add-in causes the Office application to crash (close unexpectedly), the add-in gets “hard disabled”. Please follow this instruction to re-enable the add-in. In addition, you might want to check the “HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Resiliency\DisabledItems” (replace 12.0 with 11.0 for Office 2003 and with 14.0 for Office 2010). Your add-in should not have an entry under this registry key.
Debugging in Application-Level Projects
TroubleShooting COM Add-In Load Failure
Good day to you!