Prevent or record disabling of addin

Add-in Express™ Support Service
That's what is more important than anything else

Prevent or record disabling of addin
 
ludwigvan




Posts: 19
Joined: 2017-12-30
We would like to either prevent users from disabling the addin, or if we cannot do that, record the action and show a warning.

We thought of using AddinBeforeShutdown, but it is also called when exiting the application.

1. Is there a way to distinguish bt. a shutdown of the addin via manual user action vs closing the application? In Word, we have the application quit event being called before addinshutdown, which allows us to distinguish, but we couldn't find a way for others (excel doesn't expose app quit, it exposes workbook close, which does not seem to help)

2. Is there a way to prevent user from disabling the addin? Is having two addins that prevents disabling the other addin?
Posted 10 Jul, 2018 05:53:07 Top
Andrei Smolin


Add-in Express team


Posts: 15572
Joined: 2006-05-11
Hello ludwigvan,

You can't prevent turning an add-in off.

In order to turn an add-in off, you open the COM Add-ins dialog or Options dialog. I would intercept invoking the Ribbon commands opening these dialogs and check if the add-in get turned off before the code intercepting that Ribbon command returns. Find an example of intercepting opening the Options dialog in How to create a custom event when Excel calculation mode changes.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Jul, 2018 06:19:08 Top
ludwigvan




Posts: 19
Joined: 2017-12-30
Thank you Andrei, I'll give that one a try.
Posted 10 Jul, 2018 06:23:08 Top
Andrei Smolin


Add-in Express team


Posts: 15572
Joined: 2006-05-11
Welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 10 Jul, 2018 06:28:46 Top