功能区 XML:自定义 Excel 选项卡随着菜单的添加而消失

Ribbon XML: Custom Excel Tab Disappears with Addition of Menu

你好,我的自定义 Excel 标签有一个相当令人沮丧的问题。我目前有大约 20 个按钮,它们都可以做各种不同的事情,我想实现一些菜单来稍微整理一下选项卡。我有一个带有一堆宏的加载项和一个嵌入式 customUI.xml 文件来组织所有按钮。

问题是,每当我尝试将我认为非常好的菜单 xml 代码添加到 customUI.xml 文件,并将其重新嵌入加载项时,选项卡就会停止在我重新加载 Excel 时出现。在我放入菜单之前,选项卡就在那里,一切都很好,但是当我添加菜单代码时,它只是不想再显示了。下面是我正在尝试做的一个例子。

<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>

无论我是否将菜单嵌入组中,它仍然导致标签根本不显示。是我正在使用的架构吗?我对自己做错了什么感到困惑。另外,如果有任何帮助,我正在使用 Excel 2016。

提前感谢您的帮助。

您需要从菜单中的按钮中删除尺寸 属性 并将其添加到菜单本身:

<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>