0

I am trying to hide all tabs on Excel except for one Custom tab (using Custom UI). XML code:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    <ribbon startFromScratch="false">
        <tabs>
            <tab id="customTab" label="Custom Layout" insertBeforeMso="TabHome">
            </tab>
            <tab idMso="TabHome" visible="false" />
                <tab idMso="TabInsert" visible="false" />
                <tab idMso="TabFormulas" visible="false" />
                <tab idMso="TabData" visible="false" />
                <tab idMso="TabReview" visible="false" />
                <tab idMso="TabView" visible="false" />
                <tab idMso="TabDeveloper" visible="false" />
            <tab idMso="TabPageLayout" visible="false"/>
        </tabs>
    </ribbon>
</customUI>

This hides everything except Page Layout. Any idea why that is?

Thanks

Oday Salim
  • 1,129
  • 3
  • 23
  • 46

3 Answers3

2

If all tabs are to be hidden it is better to use

<ribbon startFromScratch="true">
cybernetic.nomad
  • 6,100
  • 3
  • 18
  • 31
  • An elegant solution, but it still does not answer the question "Why doesn't this code hide Page Layout". If one wants to hide the Page Layout sheet, one can use the standard ID tag: `idMso="TabPageLayoutExcel"`. For some reason that one breaks the pattern _just enough_ to cause lots of head-scratching. –  Aug 02 '18 at 17:05
2

It can be difficult to find a list of all the possible values for idMso in any case. However, I found this list below, which indicates that the idMso for the Page Layout tab is "TabPageLayoutExcel".

<tab idMso="TabAddIns" visible="false" />
<tab idMso="TabBackgroundRemoval" visible="false" />
<tab idMso="TabData" visible="false" />
<tab idMso="TabDeveloper" visible="false" />
<tab idMso="TabFormulas" visible="false" />
<tab idMso="TabHome" visible="false" />
<tab idMso="TabInsert" visible="false" />
<tab idMso="TabPageLayoutExcel" visible="false" />
<tab idMso="TabReview" visible="false" />
<tab idMso="TabView" visible="false" />

Credit to @GoldBishop for his answer to this question, from which this list of idMso's was taken.

-1

on the excel ribbon, it is "Page Layout" could it be as simple as adding a space to the declaration?