Same function different add-ins

Ever since Microsoft introduced the ribbon and I did my initial development work with it, an open issue has been how to handle the case where two, or more, add-ins offer the same functionality. One scenario is when the feature is something required for the larger functionality offered by an add-in. Here’s an example.

The TM Chart Utilities add-in offers the capability whereby for a chart series labels one can specify a range other than just the X or Y values.

The TM Chart Labels Hover add-in, developed to display a label only when the user hovers over the associated data point, incorporates, as a sub-function, if you will, the capability to specify a range as the source for a series’ data labels. The UI and the code are the same in the two add-ins (I essentially copy the form and the supporting modules from one add-in to the other).

The problem is that with both add-ins installed the UI displays two buttons, both labeled Set Data Labels, that do the same time. It looks clumsy, to say the least.

What I would like is that whether one or both of the add-ins are installed, there is only one Set Data Labels button.

For a version in a page by itself (i.e., not in a scrollable iframe as below) visit http://www.tushar-mehta.com/publish_train/xl_vba_cases/1019%20Same%20function%20Different%20AddIns.shtml

Tushar Mehta

6 Comments

  1. HI,

    I like the idea, although I currently have no need of it. What I can’t work out is how you got 2 documents to add items to a custom ribbon though. I can’t find any examples and my own attempts end up with 2 tabs, of the same name!!!!

    Any pointers would be appreciated.

    Thanks

    M

  2. Hi,

    Thanks, the archive is down but The Wayback Machine http://web.archive.org/ scrapped your original post and I think I get what I need to do. I’l try in the morning. I take it from your current post that MS fixed:

    If there are two application level (XLAM) add-ins loaded, they both share a RibbonX namespace, and they both have a onLoad attribute specified, the callback routine in the first add-in to be loaded is the only one called.

    If not I might have to ask how you got around it?

    Thanks again,

    M

    • Prepend the code module’s name. So, if in Addin1 you have the ribbonx callback routines in a module named AddIn1RibbonXCode and in Addin2 the callback routines are in AddIn2RibbonXCode, then you can specify the callback routines, including the onload routine as Addin1RibbonXCode.onLoad and Addin2RibbonXCode.onLoad.

      Or, just name each onLoad routine uniquely as in Addin1onLoad and Addin2onLoad. ;-)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>