Question

I've written a custom ribbon for word. In my winForms-application I also open a word document with word-Interop to create some texts with word.

When I use normal word documents my ribbon is shown correct but when I open the document in my application then the ribbon is gone.

I found out that it is somehow disabled in the COM-AddIn-Options in Word. When I reactivate it manually it appears.

How can I reactivate it programmatically?

[Update] For better understanding: I have two solutions. 1) A AddIn for Word which displays a ribbon 2) A winform-application which has a winword-control which loads word in it.

When the second one is started the first one is not available anymore.

Était-ce utile?

La solution

To answer your question, it's not possible to programatically re-enable your add-in from the add-in itself. Think about it - it doesn't get loaded, so its code won't get run. So nothing you put in your code will re-enable the addin, because it won't get executed.

The only way would be to create a watchdog process that checks if the COM add-in has been disabled every 10 minutes or so, and re-enables it. You'll need to know where Word stores those settings though.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top