Reputation: 32088
I have a custom Ribbon which looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<backstage>
<tab id="CustomTab" insertBeforeMso="TabInfo" title="CustomTab" label="CustomTab">
<firstColumn>
<group id="openGroup">
<topItems>
<button id="btnOpen" label="Search" onAction="OpenForm" />
<button id="btnSave" label="Save" onAction="SaveForm" />
<button id="btnSaveAs" label="Save As" onAction="SaveAsForm" />
</topItems>
</group>
</firstColumn>
</tab>
<button idMso="FileSave" visible="false"/>
<tab idMso="TabRecent" visible="false" />
<tab idMso="TabSave" visible="false" />
<tab idMso="TabShare" visible="false"/>
</backstage>
</customUI>
While this works great at hiding the built-in tabs, it doesn't hide the Save button from the Quick Access Toolbar.
I looked at the Office Help files, and supposedly FileSave
is the ID of the Save button, but it doesn't hide it. I also tried with Undo
which should hide the Undo button from the Quick Access Toolbar but that doesn't work either.
Is it possible at all to programmatically or through the custom Ribbon hide elements in the Quick Access Toolbar? I'm targeting Word, Excel and PowerPoint 2013 and 2016
Upvotes: 1
Views: 1456
Reputation: 32088
I will leave this here (mix between what @asdev posted and the common tabs and controls for Word) in case it helps someone.
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<ribbon startFromScratch="true">
<qat>
<sharedControls>
<control idMso="Undo" visible="true" />
<button idMso="RedoOrRepeat" visible="true"/>
</sharedControls>
</qat>
<tabs>
<tab idMso="TabHome" visible="true"></tab>
<tab idMso="TabInsert" visible="true"></tab>
<tab idMso="TabWordDesign" visible="true"></tab>
<tab idMso="TabPageLayoutWord" visible="true"></tab>
<tab idMso="TabReferences" visible="true"></tab>
<tab idMso="TabMailings" visible="true"></tab>
<tab idMso="TabReviewWord" visible="true"></tab>
<tab idMso="TabView" visible="true"></tab>
<tab idMso="TabOutlining" visible="true"></tab>
</tabs>
</ribbon>
</customUI>
Upvotes: 1
Reputation: 943
You need to use the child elements qat and documentControls/sharedControls in your XML.
And according to this you can only remove qat by starting from Scratch. That means you have to define all elements you want to show! Not really comfortable, to be honest
<ribbon startFromScratch="true">
<qat>
<sharedControls>
<button idMso="FileSave" visible="true" />
<button idMso="Cut" visible="true" />
<button idMso="Copy" visible="true" />
<button idMso="Paste" visible="true" />
<button idMso="FileOpen" visible="true" />
</sharedControls>
</qat>
[..define other parts you want to show, tabs etc...]
</ribbon>
Upvotes: 3