Customize the 2010 ribbon as I customized the 2003 Menu bar

mcs51mc

New Member
Joined
Nov 16, 2005
Messages
22
Hi there,
In Excel2003 I used VBA to add a menu\submenu\button to the menu bar when the user installed an AddIn. Since I have multiple AddIn’s to deploy to different end users, I needed multiple buttons in different submenus but all in the same main menu.
I used following code
Code:
 Private Sub Workbook_AddinInstall()
    Menu_Add
End Sub

Private Sub Workbook_AddinUninstall()
    Menu_Remove
End Sub
to add or remove the necessary menu\submenu\button while installing or removing an AddIn.

Thanks to Ron’s site I managed to add a tab\group\button in the ribbon of Excel 2010 :)
That works fine for one AddIn but when installing a second AddIn a second tab with the same name is created. I expected Excel to be clever enough to put 2 or more buttons in the same tab\group when the same value is used as id in the XML code, but apparently that isn’t the case.

Code in the first xlam file
Code:
ribbon
tabs
tab id="tabMyCode" label="My code" insertBeforeMso="TabHome"
group id="grpDept-A" label="Dept A"
button id="cmdAddIn001" label="AddIn 001" size="normal" onAction="AddIn001StartsHere" imageMso="ChartTypeLineInsertGallery"
/group
/tab
/tabs
/ribbon


Code in the second xlam file
Code:
ribbon
tabs
tab id="tabMyCode" label="My code" insertBeforeMso="TabHome"
group id="grpDept-A" label="Dept A"
button id="cmdAddIn005" label="AddIn 005" size="normal" onAction="AddIn005StartsHere" imageMso="ChartTypeLineInsertGallery" /
/group
/tab
/tabs
/ribbon


I’m not familiar with the ribbon so far so please don’t shoot me if the following questions are more than stupid :(

Can I use
Code:
/xsl:if
and/or
Code:
/xsl:for-each
to check what items already are in the ribbon and act accordingly, just like I did in Excel 2003 with VBA.

Is it possible to update the ribbon from VBA directly instead of using XML, or can I edit the XML part from VBA?

Other ideas? I’m all ears… …

Thanks for reading anyway!


PS: I deleted all "<" and ">" in the XML code above
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top