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

Posted in Uncategorized

4 thoughts on “Same function different add-ins

  1. “However, it appears that one cannot index the AddIns collection with the name of the add-in.” Actually you can. The trick is that the index doesn’t use the file extension, but the name does, e.g., in the immediate window:

    ? application.AddIns(“MyBar”).name
    myBar.xla

  2. Hi Doug,
    My testing and the help documentation suggests that the workbook’s Title property has to be used as the index.

    So if I simply create a Mybar.xla file your example code will work as the default title will be “mybar”. But if I add a descriptive Title property, such as “Mybar Title”, then save the file and restart excel I have to use the following,

    ?Addins(“Mybar Title”).name
    mybar.xla

    The help file uses the Analysis toolpak as an example.

    ?AddIns(“Analysis ToolPak”).name
    ANALYS32.XLL

    ?AddIns(“ANALYS32?).name
    ——————
    Microsoft Visual Basic
    ——————
    Run-time error ‘9’:

    Subscript out of range
    ——————
    OK Help
    ——————

  3. On a side note does any one know how to set the hierarchy of ShortCuts keys set in a an Addin
    I have a Addin which assigns Ctrl+L – as Toggle Auto filter
    My Client has an Addin that assigns Ctrl+L = that Left Alings text

    I want my Short Cut to take precedence over the other…Is there a way to set this


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.