Article ID: 194884
Article Last Modified on 2/27/2004
Sub ResetOutlookUserInterface()
Dim outapp As Outlook.Application
Dim olns As Outlook.NameSpace
Dim MyExplorer As Outlook.Explorer
Dim MyMenu As CommandBar
Dim MyCmd As CommandBarControl
Set outapp = New Outlook.Application
Set olns = outapp.GetNamespace("MAPI")
Set MyInbox = olns.GetDefaultFolder(olFolderInbox)
' Get the active application-level window displayed
Set MyExplorer = outapp.ActiveExplorer
' Reference the View menu
Set MyMenu = MyExplorer.CommandBars.Item("View")
' Display the Outlook Bar
Set MyCmd = MyMenu.Controls("Outlook Bar")
If MyCmd.State = msoButtonUp Then MyCmd.Execute
' Hide the Folder List
Set MyCmd = MyMenu.Controls("Folder List")
If MyCmd.State = msoButtonDown Then MyCmd.Execute
' Display the Standard toolbar
Set MyCmd = MyMenu.Controls("Toolbars").Controls("Standard")
If MyCmd.State = msoButtonUp Then MyCmd.Execute
' Hide the Advanced toolbar
Set MyCmd = MyMenu.Controls("Toolbars").Controls("Advanced")
If MyCmd.State = msoButtonDown Then MyCmd.Execute
' Hide the Remote toolbar
Set MyCmd = MyMenu.Controls("Toolbars").Controls("Remote")
If MyCmd.State = msoButtonDown Then MyCmd.Execute
' Hide the preview pane
Set MyCmd = MyMenu.Controls("Preview Pane")
If MyCmd.State = msoButtonDown Then MyCmd.Execute
' Display the status bar
Set MyCmd = MyMenu.Controls("Status Bar")
If MyCmd.State = msoButtonUp Then MyCmd.Execute
Set MyCmd = Nothing
Set MyMenu = Nothing
Set MyExplorer = Nothing
Set olns = Nothing
Set outapp = Nothing
End Sub
182394 OL98: How to Use Command Bars in Outlook Solutions
180826 OL98: Resources for Custom Forms and Programming
182349 OL98: Questions About Custom Forms and Outlook Solutions
Additional query words: kbDSupport kbOutlook kbAutomation kbOutlook97 kbOutlook98 kbOutlookObj OutSol OutSol98 vbscript
Keywords: kbhowto kbprogramming kbautomation KB194884