如何以编程方式停止出现在Office 2010中的“研究”工具栏?

单击“Alt”button,在Office 2010中创build一个令人讨厌且持久的“研究”工具栏。

我怎样才能通过VBA删除这个?

您也可以通过VBA在Outlook中执行此操作。 Office 2010不再允许您通过大多数这些解决scheme删除。

Word,PowerPoint和Excel允许您使用这个简单。 只需使用:

Application.CommandBars("Research").Enabled = False 

将从这些应用程序中禁用命令行。


Outlook需要更多的麻烦,因为它使用了Explorers和Inspector,在不同的上下文中都有这个命令栏被启用。 因此解决scheme是两个部分。

第一部分是设置WithEvents来处理每个新Inspector的创build。 一般来说,无论何时你打开一个消息/事件/ etc,并且它们每次都被创build/销毁。 所以,即使你击中每个当前的Inspector,你的新的都不会禁用命令栏。

将下列内容放入VBA编辑器中的ThisOutlookSession(Alt + F11)。 每个新的检查员(也是资源pipe理器,虽然我还没有创build一个资源pipe理器)将禁用其命令栏。


 Public WithEvents colInspectors As Outlook.Inspectors Public WithEvents objInspector As Outlook.Inspector Public WithEvents colExplorers As Outlook.Explorers Public WithEvents objExplorer As Outlook.Explorer Public Sub Application_Startup() Init_colExplorersEvent Init_colInspectorsEvent End Sub Private Sub Init_colExplorersEvent() Set colExplorers = Outlook.Explorers End Sub Private Sub Init_colInspectorsEvent() 'Initialize the inspectors events handler Set colInspectors = Outlook.Inspectors End Sub Private Sub colInspectors_NewInspector(ByVal NewInspector As Inspector) Debug.Print "new inspector" NewInspector.commandbars("Research").Enabled = False 'This is the code that creates a new inspector with events activated Set objInspector = NewInspector End Sub Private Sub colExplorers_NewExplorer(ByVal NewExplorer As Explorer) 'I don't believe this is required for explorers as I do not think Outlook 'ever creates additional explorers... but who knows Debug.Print "new explorer" NewExplorer.commandbars("Research").Enabled = False 'This is the code that creates a new inspector with events activated Set objExplorer = NewExplorer End Sub 

但是,这只会从Outlook中的一些视图中得到菜单。 您仍然需要运行以下macros将其从所有探索者中删除。 最好,我可以告诉这是持久性closures/重新打开Outlook时:

 Private Sub removeOutlookResearchBar() 'remove from main Outlook explorer Dim mExp As Explorer For Each mExp In Outlook.Explorers mExp.commandbars("Research").Enabled = False Next mExp End Sub