This topic has not yet been rated - Rate this topic

Explorer.ViewSwitch Event (Outlook)

Published: July 16, 2012

Occurs when the view in the explorer changes, either as a result of user action or through program code.

expression .ViewSwitch

expression A variable that represents an Explorer object.

This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).

This Visual Basic for Applications (VBA) example hides the preview pane if it is visible when the user switches to Messages with AutoPreview view. The sample code must be placed in a class module, and the Initialize_handler routine must be called before the event procedure can be called by Microsoft Outlook.

Dim WithEvents myOlExpl As Outlook.Explorer 
 
 
 
Sub Initialize_handler() 
 
 Set myOlExpl = Application.ActiveExplorer 
 
End Sub 
 
 
 
Private Sub myOlExpl_ViewSwitch() 
 
 If myOlExpl.CurrentView = "Messages with AutoPreview" And myOlExpl.IsPaneVisible(olPreview) = True Then 
 
 myOlExpl.ShowPane olPreview, False 
 
 End If 
 
End Sub
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.