Common button across shared ribbon tab

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

Common button across shared ribbon tab
How to create a common button on a shared ribbon tab that is not repeated for each add-in 
Marcus from London

Posts: 33
Joined: 2015-04-12
Hello Gents,

I've got a series of MS Word add-ins which share a common ribbon using the technique you outline here:

It all works great. Thanks :)

The question I have is this:

I don't know what combination of these add-ins a user will have installed.
But whatever the combination they do have, I want a "Help" group & button displayed - but only once.

Right now, the help group & button is loaded once for each add-in.

Some other details:
- The ribbon and add-in specific buttons are generated by code on the add-in Initialise event
- Each "Help" group and button has the same ID across each add-in.
- I currently try to create the Help group & button on the ribbon Loaded event.
This checks if the "Help" group exists but I still end up with multiple Help buttons (one for each add-in) as the check comes back negative.
I've used both the Help group ID and caption to check for an existing group without success.

Would you be able to suggest how I should approach this?

Thanks - Marcus
Posted 25 Aug, 2017 04:44:55 Top
Andrei Smolin

Add-in Express team

Posts: 17125
Joined: 2006-05-11
Hello Marcus,

Here is a raw idea. Every add-in has a Help button of its own; the button is hidden by default. You need the add-ins to cooperatively assign the add-in responsible for showing the button. When such an add-in is assigned, it shows its Help button. When this add-in is turned off by the user(!), it initiates the next round of the cooperative assignment game.

To find if the add-ins show the Help button, I would implement the DoYouShowTheHelpButton method in every add-in, and call that method in this way (this is a raw sketch):

Office.COMAddins addins = WordApp.COMAddins;
for (int iAddin = 1; iAddin <= addins.Count; iAddin++){
    Office.COMAddin addin = addins[iAddin]; 
    if (addin.Connect && addin.ProgId != myProgId){
        // use late binding to call the method
        bool result = false;
        try {
            result = (bool)addin.GetType().InvokeMember("DoYouShowTheHelpButton", ... ); 
        } catch (Exception ex){
            // the method isn't found
        // analyze the result here
// if no add-in shows the button, show it here

To check if the user is turning the add-in off, you may need to use Windows API to check if the COM Add-ins dialog is shown before (or at the moment when) the AddinBeginShutdown event is raised on the add-in module.

I suppose a simpler version of the above may exist.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Aug, 2017 08:31:26 Top