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
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 in the second xlam file
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
and/or
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
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
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
Code:
/xsl:for-each
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