Home » excel » xml – I'd like to hide (not disable) 'protect workbook' from the review tab in command bar Excel (customUI)

xml – I'd like to hide (not disable) 'protect workbook' from the review tab in command bar Excel (customUI)

Posted by: admin May 14, 2020 Leave a comment

Questions:

Hi I’d like to hide the protect workbook button in the Excel ribbon (in the review tab). I know this is possible by implementing a customUI. (As explained on http://www.rondebruin.nl/ )

I already found the idMso for this button and managed to disable it.

idMso: ReviewRestrictEditing

I had no succes in my attempts for hinding the button from the ribbon. This is what I have so far:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">     
<ribbon>

<tabs>

<tab idMso="TabReview" >
<group idMso="?????????????" >
    <button idMso="ReviewRestrictEditing" visible = "false" /> 
</group>
</tab>

</tabs>

</ribbon>
</customUI> 

How can I find the group idMso? I went over a list for excel 2007, but haven’t found the correct id yet.

How to&Answers:

Did you read Ron’s article on how to Change built-in groups in the Ribbon in Excel 2007-2016

It is not possible to add to or remove controls from built-in groups in the Ribbon. For example, the Format Painter button from the Home tab’s Clipboard group cannot be removed from this group.

But there is a way around this restriction. We can hide a built-in group and then duplicate it with RibbonX. And then we can modify our duplicate group anyway we want.

Question is what version of Excel are you using?

There are sample files for 2007/2010 & 2016 that replace all groups

You can also find a list of the idMso values for Excel 2007 HERE and
a Word document with the idMso values for Excel 2007 – 2013 [MS-CUSTOMUI]-160715

Since I wanted to test it myself, I might as well share what I came up with (it’s different from what is in the sample files, since I’m using Excel 2013 and Ron doesn’t have it available)

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon> 
<tabs>

<!-- Set visible to false for the Changes group on the Review tab-->
<tab idMso="TabReview"> 
<group idMso="GroupChangesExcel" visible="false"/>  
</tab>


<!-- Point to the Built-in tab to the ribbon -->
<tab idMso="TabReview"> 

<!-- Add Changes group -->
<group id="DupChanges" label="Changes" insertBeforeMso="GroupChangesExcel" >    
    <button idMso="SheetProtect" size="large"/> 
    <!-- button idMso="ReviewProtectWorkbook" size="large" / --> 
    <button idMso="ReviewShareWorkbook" size="large"/>

    <button idMso="ReviewProtectAndShareWorkbook" />
    <button idMso="ReviewAllowUsersToEditRanges" />
    <menu idMso="ReviewTrackChangesMenu" />
</group> 

</tab>


</tabs> 
</ribbon> 
</customUI>

Depending on which CUI file customUI.xml (2007) vs customUI14.xml (2010) the idMso may change, which happens to be the case for the Protect Workbook button your asking about. I just stick to the 2007, since I haven’t had a need for any Backstage stuff yet.