Search code examples
vbaexcelribboncommandbar

How to disable “Save and send” in Excel 2010 (in the File ribbon and from quick access bar)?


I try to rename my file myfile.xlsb to myfile.zip then open zip archive, create in them folder customUI, put in this folder file customUI.xml with data

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
               <backstage>
                              <tab idMso="TabShare" visible="false"/> 
               </backstage>
</customUI>

And then tried with data

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<officeMenu>
<menu idMso="FileSendMenu" enabled="false"/>
</officeMenu>
</ribbon>
</customUI>

and then

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<officeMenu>
<menu idMso="FileSendMenu">
<button idMso="FileSendAsAttachment" enabled="false"/>
<button idMso="FileEmailAsXpsEmailAttachment" enabled="false"/>
</menu>
</officeMenu>
</ribbon>
</customUI>

Then I put in .rels file

<Relationship Id="rId5" 
Type="http://schemas.microsoft.com/office/2006/relationships/
ui/extensibility" Target="customUI/customUI.xml"/>

between required tags and change this file in zip archive. Then I rename myfile.zip to myfile.xlsb and open it but all send button still alive. Also I tried to change all reference (http://schemas.microsoft.com/office/2006/relationships/ by http://schemas.microsoft.com/office/2009/07/customui) but no effect

This one also do not hide this buttons.

Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Send To").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save & Send").Enabled = False

I need to disable this one and control it from VBA.

Control Name:   SendCopySendToMailRecipient ; FileEmailAsPdfEmailAttachment ; FileEmailAsXpsEmailAttachment ; SendUsingEmail ; GroupSendUsingEmail
Control Type:   toggleButton ; button ; button ; task ; group
Tab Set:    None (Not in the Ribbon) ; None (Not in the Ribbon) ; None (Not in the Ribbon) ; None (Backstage View) ; None (Backstage View)
Tab:    None (Not in the Ribbon) ; None (Not in the Ribbon) ; None (Not in the Ribbon) ; TabShare ; TabShare
Group:  - ; None (Not in the Ribbon) ; None (Not in the Ribbon) ; GroupShare ; GroupShare
Parent Control:     - ; FileSendMenu ; FileSendMenu ; Share ; Share
Secondary Parent Control:   - ; - ; - ; - ; SendUsingEmail          
Policy ID:  3738 ; 15730 ; 15731 ; 18209 ; 18166
Ordering:       645 ; 1049 ; 1050 ; 2219 ; 2220

Solution

  • This hides almost everything - maybe helps:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
       <ribbon startFromScratch="true">
       <qat>
         <documentControls>
        <control 
           idMso="WindowSwitchWindowsMenuExcel"
           screentip="SWITCH EXCEL FILE"
           supertip="Click here to switch from this workbook to another open excel file."/>
        <control 
           idMso="FilePrint"
           screentip="PRINT FILE"
           supertip="Click here to enable the print menu."/>
         </documentControls>
        </qat>
        </ribbon>
    </customUI>