0

We have written a C# Excel add-in using Visual Studio Tools for Office (VSTO). For whatever reason, users who have installed the SAP IBP Excel add-in now have our add-in disabled every time Excel starts. They can go in and re-enable it (File->Options->Add Ins->COM, etc), but they have to do that every time Excel starts.

Does anyone know of a way to have Excel, on start-up, check if our add-in is loaded, and if not, have it enable it?

I would even be open to putting code into the personal spreadsheet (if that concept still exists) that does it if it's possible.

Hambone
  • 15,600
  • 8
  • 46
  • 69
  • Usually Excel will disable the addin if some runtime exception has occured during loading. Adding logging in the ThisAddIn_Startup should point you in the right direction. Another think to check is the Load Behaviour - for more info you can check this SO question - https://stackoverflow.com/a/14698249/5232050 – vasil oreshenski Oct 15 '19 at 12:08

1 Answers1

1

Microsoft Office applications can disable VSTO Add-ins that behave unexpectedly. If an application does not load your VSTO Add-in, the application might have hard disabled or soft disabled your VSTO Add-in.

Hard disabling can occur when a VSTO Add-in causes the application to close unexpectedly. It might also occur on your development computer if you stop the debugger while the Startup event handler in your VSTO Add-in is executing.

Soft disabling can occur when a VSTO Add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable a VSTO Add-in if it throws an unhandled exception while the Startup event handler is executing.

When you re-enable a soft-disabled VSTO Add-in, the application immediately attempts to load the VSTO Add-in. If the problem that initially caused the application to soft disable the VSTO Add-in has not been fixed, the application will soft disable the VSTO Add-in again.

Read more about that in the How to: Re-enable a VSTO Add-in that has been disabled article.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45