Search code examples
excelxmlvbaribbonx

Ribbon XML: Custom Excel Tab Disappears with Addition of Menu


Heylo, I am having a rather frustrating issue with my custom Excel Tab. I currently have about 20 buttons that all do a variety of different things, and I would like to implement some menu's to declutter the tab a bit. I have an add-in with a bunch of macros and an embedded customUI.xml file to organize all of the buttons.

The problem is, whenever I try to add what I see as perfectly fine menu xml code to the customUI.xml file, and re-embed it in the add-in, the tab ceases to show up when I reload Excel. Before I put the menu in, the tab is there and everything is fine, but when I add the menu code, it just doesn't want to show up anymore. Below is an example of what I'm trying to do.

<customUI xmlns = "http://schemas.microsoft.com/office/2006/01/customui">
   <ribbon>
      <tabs>
         <tab id = "MyTab" label = "My Tab">
            <group id = "About" label = "About">
               <button id        = "Button1"
                       label     = "About My Tab"
                       size      = "large"
                       onAction  = "AboutMyTab"
                       imageMso  = "Help" 
                       screentip = "About My Tab"
                       supertip  = "Shows a dialog box that displays information about My Tab."
               />
            </group>
            <group id = "TestMenus" label = "My Test Menu">
               <menu id = "MyMenu" label = "The Menu">
                  <button id = "ButtonX" label = "X" size = "large" imageMso = "FileSave" />
                  <button id = "ButtonY" label = "Y" size = "large" imageMso = "Bold" />
                  <button id = "ButtonZ" label = "Z" size = "large" imageMso = "Undo" />
               </menu>
            </group>
         </tab>
      </tabs>
   </ribbon>
</customUI>

Whether I embed the menu in a group or not, it still causes the tab to not show up at all. Is it the schema I am using? I am confused on what I am doing wrong. Also, I am using Excel 2016 if that helps in any way.

Thank you for any help in advance.


Solution

  • You need to remove Size property from buttons in menu and add it to menu itself:

    <menu id = "MyMenu" label = "The Menu" itemSize = "large">
        <button id = "ButtonX" label = "X" imageMso = "FileSave" />
        <button id = "ButtonY" label = "Y" imageMso = "Bold" />
        <button id = "ButtonZ" label = "Z" imageMso = "Undo" />
    </menu>