Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Explorer.CurrentView Property (Outlook)

Published: July 16, 2012

Returns or sets a Variant representing the current view. Read/write.

expression .CurrentView

expression A variable that represents an Explorer object.

To obtain a View object for the view of the current Explorer, use Explorer.CurrentView instead of the CurrentView property of the current Folder object returned by Explorer.CurrentFolder.

You must save a reference to the View object returned by CurrentView before you proceed to use it for any purpose.

To properly reset the current view, you must do a View.Reset and then a View.Apply. The code sample below illustrates the order of the calls:

Sub ResetView() 
 
 Dim v as Outlook.View 
 
 ' Save a reference to the current view object 
 
 Set v = Application.ActiveExplorer.CurrentView 
 
 ' Reset and then apply the current view 
 
 v.Reset 
 
 v.Apply 
 
End Sub 
 

When this property is set, two events occur: BeforeViewSwitch occurs before the actual view change takes place and can be used to cancel the change and ViewSwitch takes place after the change is effective.

The following Visual Basic for Applications (VBA) example sets the current view in the active explorer to messages if the Inbox is displayed.

Sub ChangeCurrentView() 
 
 Dim myOlExp As Outlook.Explorer 
 
 
 
 Set myOlExp = Application.ActiveExplorer 
 
 If myOlExp.CurrentFolder = "Inbox" Then 
 
 myOlExp.CurrentView = "Messages" 
 
 End If 
 
End Sub
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.