View.Apply Method (Outlook)
Office 2013
Published: July 16, 2012
Applies the view to the Microsoft Outlook user interface.
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
The following Visual Basic for Applications (VBA) example creates a new view called New Table and applies it.
Sub CreateView()
'Creates a new view
Dim objName As Outlook.NameSpace
Dim objViews As Outlook.Views
Dim objNewView As Outlook.View
Set objName = Application.GetNamespace("MAPI")
Set objViews = objName.GetDefaultFolder(olFolderInbox).Views
Set objNewView = objViews.Add(Name:="New Table", _
ViewType:=olTableView)
objNewView.Save
objNewView.Apply
End Sub