Views Property

Microsoft Outlook Visual Basic

Views Property

       

Returns a Views collection. Each View object in the Views collection defines the manner in which items are displayed in an Explorer.

expression.Views

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

The following example creates an instance of the Views collection and returns a view called "Table View".

Sub GetView()
'Returns a view object

    Dim olApp As Outlook.Application
    Dim objName As NameSpace
    Dim objViews As Views
    Dim objView As View

    Set olApp = Outlook.Application
    Set objName = olApp.GetNamespace("MAPI")
    Set objViews = objName.GetDefaultFolder(olFolderInbox).Views
    'Return a view called Table View
    Set objView = objViews.Item("Table View")

End Sub