Skip to content

Latest commit

 

History

History
89 lines (47 loc) · 1.48 KB

Outlook.View.Apply.md

File metadata and controls

89 lines (47 loc) · 1.48 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
View.Apply method (Outlook)
vbaol11.chm2484
vbaol11.chm2484
Outlook.View.Apply
b121d1ce-24b7-4ace-8369-42e5c7becd0a
06/08/2017
medium

View.Apply method (Outlook)

Applies the view to the Microsoft Outlook user interface.

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:

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.

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

See also

View Object

[!includeSupport and feedback]