如何禁用“保存并发送”在Excel 2010(在文件功能区(在Office 2010中称为后台)? [英] How do you disable "Save and send" in Excel 2010 (in the File ribbon (called backstage in Office 2010)?

查看:172
本文介绍了如何禁用“保存并发送”在Excel 2010(在文件功能区(在Office 2010中称为后台)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel 2003中运行了以下VBA marco,它阻止保存,另存为,保存工作区,发送到
菜单,但现在需要执行相同的操作,但是对于Excel 2010?


Application.CommandBars(Worksheet菜单栏)。控件(文件)。控件(另存为...)Enabled = False




Application.CommandBars(Worksheet菜单栏)。控件(文件)。控件(保存)。Enabled = False

< br>


Application.CommandBars(Worksheet菜单栏)。控件(文件)。控件(保存工作区...)Enabled = False





Application.CommandBars(Worksheet菜单栏)。控件(文件)。控件(发送到)Enabled = False





Application.CommandBars(Worksheet菜单栏)。控件(格式)。控件(Sheet)。Enabled = False




Excel 2010中有一个新菜单,名为保存并发送(在文件下丝带),我也想脱掉你怎么这样做的?我正在搜索相当于这样一条线:




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



您的帮助。

解决方案

对于Microsoft的Ribbon UI示例/文档,这里。他们会建议您使用 CustomUI Editor



在CustomUI编辑器中打开您的文件(它必须是XLSX,XLSM,XLAM等的Excel 2007+文件扩展名)。然后在编辑器中使用这个XML:

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

保存文件,并关闭CustomUI编辑器。



然后,打开你的文件。转到File / Backstage视图,您应该会看到保存并发送选项卡已被删除:



< img src =https://i.stack.imgur.com/Cout9.jpgalt =禁用TabShare的屏幕截图>



注意: / strong>这已经从后台视图中禁用了整个保存并发送选项卡。应该可以使用XML来调整这一点,即启用该选项卡,但禁用其中的特定控件(例如,也许您只想禁用作为附件发送,但是您想要启用其他选项等),但是我还没有完成XML层次结构,以仅限制



希望这有帮助!



从评论更新



1)当该文件关闭时,或当另一个文件为活动时,用户将找到正常功能。 UI定制仅适用于包含自定义UI XML部分的文件,因此如果打开多个文件,则只有此文件将受到禁用 Save&发送标签。



2)不幸的是,这不是兼容于Excel 2003或更早版本。 CustomUI / XML不是旧版XLS文件的一部分,因此无法在这些版本中实现。对于2003年/以前版本的Excel,您将不得不使用可通过VBA控制的旧版 CommandBars 。相对来说,放置一些VBA代码将检查哪个版本的Excel,并运行一个子例程来禁用某些 CommandBar / Controls只有当用户在2003或以前的版本



如果您尝试将其保存到XLS文件,您将收到一条警告,表示此功能与文件类型不兼容:





此外,您无法在CustomUI编辑器中打开XLS文件。


I have the following VBA marco running in Excel 2003, it blocks the Save, Save as, Save Workspace, Send To menus but I now need to do the same but for Excel 2010 ?

Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save As...").Enabled = False

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

Application.CommandBars("Worksheet Menu Bar").Controls("File").Controls("Save Workspace...").Enabled = False

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

Application.CommandBars("Worksheet Menu Bar").Controls("Format").Controls("Sheet").Enabled = False

There is a 'new menu' in Excel 2010 called "Save and send" (under the File ribbon) that I would like to also disable... How do you do this ? I’m searching for the equivalent to a line like this one:

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

Thank you for your help.

解决方案

For Ribbon UI example/documentation from Microsoft, here. They will recommend you use the CustomUI Editor.

Open your file (which must be an Excel 2007+ file extension like XLSX, XLSM, XLAM, etc) in the CustomUI Editor. Then use this XML in the editor:

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

Save the file, and close the CustomUI Editor.

Then, open your file. Go to the File/Backstage view and you should see that the Save and Send tab has been removed:

Note: This has disabled the entire "Save & Send" tab from the backstage view. It should be possible using XML to fine-tune this, i.e., to enable the tab, but disable specific controls therein (e.g., maybe you only want to disable Send as Attachment but you want to leave the other options enabled, etc.) but I haven't quite worked out the XML hierarchy to disable only the specific Send As Attachment control.

Hope this helps!

Update from Comments

1) The user will find "normal" functionality when this file is closed, or when another file is Active. The UI customization only applies to the file which contains the Custom UI XML parts, so if you have multiple files open, only this file will be affected by the disabled Save & Send tab.

2) Unfortunately, this is not compatible with Excel 2003 or prior. The CustomUI/XML is not a part of the legacy XLS files, and as such, cannot be implemented in these versions. For 2003/prior versions of Excel, you will have to use the legacy CommandBars which can be controlled through VBA. It is relatively easy to put some VBA code that will check which version of Excel, and run a subroutine to disable certain CommandBar/Controls only if the user is in 2003 or prior versions.

If you try to save this down to an XLS file, you will receive a warning, indicating that this feature is incompatible with the file type:

Additionally, you cannot open an XLS file in the CustomUI Editor.

这篇关于如何禁用“保存并发送”在Excel 2010(在文件功能区(在Office 2010中称为后台)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆