Excel隐藏/显示功能区上的所有选项卡,但自定义选项卡
如何使用VBA(而不是XML)隐藏和显示所有标准Excel功能区选项卡。我不想隐藏整个功能区(如下所述: VBA最小化功能区在Excel )只是选项卡。我知道如何使用XML的startFromScratch,所以请不要建议或其他XML解决方案。
How can I hide and show all the standard Excel ribbon tabs using VBA (not XML). I do not want to hide the whole ribbon (as is asked here: VBA minimize ribbon in Excel) just the tabs. I know how to use startFromScratch using XML so please do not suggest that or other XML solutions.
到目前为止,我已经进行了广泛的Google搜索,并查看:
So far I have done an extensive Google search and looked at:
- http://msdn.microsoft.com /en-us/library/office/ee390805(v=office.11).aspx
- http:// msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.officeribbon.startfromscratch.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
- 使用Excel中的VBA自定义功能区
- 使用Excel VBA在XLS文件中显示Excel 2007功能区
- 使用Excel VBA在XLS文件中显示Excel 2007功能区
- 功能区GUI指南
- Excel CustomUI功能区布局
- http://www.rondebruin.nl/win/s2/win012.htm
- http://msdn.microsoft.com/en-us/library/office/ee390805(v=office.11).aspx
- http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.officeribbon.startfromscratch.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
- Customizing a ribbon with VBA in Excel
- Show Excel 2007 Ribbon in XLS file using Excel VBA
- Show Excel 2007 Ribbon in XLS file using Excel VBA
- Ribbon GUI Guidelines
- Excel CustomUI ribbon layout
- http://www.rondebruin.nl/win/s2/win012.htm
我所说的是我已经进行了广泛的搜索,尝试了许多事情,没有得到结果。
What I am saying is I have already done an extensive search and tried many things without getting a result.
如何使用VBA(而不是XML)隐藏和显示所有标准Excel功能区选项卡
How can I hide and show all the standard Excel ribbon tabs using VBA (not XML)
答案是你不能。
AFAIK,你不能使用VBA。不幸的是,VBA不会公开选项卡。您唯一的选项如下图所示
AFAIK, you can't do that using VBA. Unfortunately VBA doesn't expose the tabs. The only options that you have are as shown in the image below
所以你可以使用命令栏,commandbarButton,commandbarComboBox等...
So you can work with the commandbar, commandbarButton, commandbarComboBox etc...
您可以说设置cbar = Application.CommandBars(Ribbon)
,但之后,您将遇到的问题是如何获取选项卡的句柄
You can say that Set cbar = Application.CommandBars("Ribbon")
but after that, the problem that you will face is how to get a handle for the tabs.
您可以使用VBA使用功能区:
- 确定特定控件是启用/可见/压缩(Toggleboxes / CheckBoxes)
- 获取控件的标签,屏幕提示或超标显示与$ b相关联的映像$ b控制。
- 执行特定控件。
使用VBA的功能区:
- 确定当前选中的标签。
- 激活特定标签
- 隐藏特定标签
- 添加新标签
- 添加新组
- 添加新控件。
- 删除/禁用/隐藏控件。
- Determine which tab is currently selected.
- Activate a particular tab.
- Hide a particular tab
- Add a new tab.
- Add a new group to a tab.
- Add a new control.
- Remove/Disable/Hide a control.
然而,您可以使用XML来实现想要的内容。例如
You can however use XML to achieve what you want. For example
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab idMso="TabReview" visible="false" />
</tabs>
</ribbon>
</customUI>
但我想你不想通过XML路线走。
But I guess you do not want to go via the XML Route.