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.
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
- 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.
Best Answer
The answer is "YOU CAN'T".
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
So you can work with the commandbar, commandbarButton, commandbarComboBox etc...
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.What you can do with the Ribbon using VBA:
What you can't do with the Ribbon using VBA:
You can however use XML to achieve what you want. For example
But I guess you do not want to go via the XML Route.