如何使用 VSTO 在 Excel 中的自定义 xml 功能区中禁用其他工具栏

How to disable other toolbar in my custom xml ribbon in Excel using VSTO

这是一种情况:我用一些按钮为 Office(Word、Excel、PowerPoint)创建了自己的功能区。功能区是在 C#、VSTO、XML(不是设计器)中创建的。所以在所有这些程序中都有一个新的功能区,其中有一个功能区组,其中是我的按钮。唯一的例外是 Excel,其中有一个 "Custom Toolbar" 小组排在第一位,而我的小组排在第二位。最棒的是,这个 "Cutsom Toolbar" 不会出现在我安装了加载项的每台计算机上。 我的问题:这个 "Custom Toolbar" 如何出现在我创建的新功能区上,有什么方法可以禁用它吗? 色带代码:

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <ribbon startFromScratch="false">
    <tabs>
      <tab idMso="TabAddIns" label="MyAddIn">
        <group id="GroupInclude" label="MyAddIn">
          <button id="saveMyAddIn" label="Save my file" getImage="imageButton" size="large"
             onAction="saveMyAddInButton" getEnabled="GetEnabled"
          />
          <button id="configurMyAddIn" label="MyAddIn Options" getImage="imageButton"
             onAction="configureMyAddInButton"
          />
          <button id="goToMyAddIn" label="Go to MyAddIn" getImage="imageButton"
             onAction="goToMyAddInButton"
          />
          <button id="aboutMyAddIn" label="About MyAddIn" getImage="imageButton"
             onAction="aboutMyAddInButton"
          />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

如果您在“插件”选项卡中看到此 "Custom Toolbar",则说明您的计算机中安装了另一个插件。 您需要删除或禁用它,

禁用 转到文件 => 选项 => 加载项选项卡 => 在管理下拉列表中选择 COM 加载项并单击开始,您应该加载所有加载项。

完全删除插件取决于它是什么插件。

转到选项卡的属性 并将 ControlIdType 更改为 Custom 解决了我的问题。