Share via


View.Apply Method

Outlook Developer Reference

Applies the view.

Syntax

expression.Apply

expression   A variable that represents a View object.

Remarks

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:

Visual Basic for Applications
  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

Example

The following Visual Basic for Applications (VBA) example creates a new view called New Table and applies it.

Visual Basic for Applications
  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.<strong>Apply</strong>

End Sub

See Also