ViewType Property
ViewType property as it applies to the OutlookBarGroup object.
Returns or sets the icon view displayed by the specified Outlook bar group. Read/write OlOutlookBarViewType.
OlOutlookBarViewType can be one of these OlOutlookBarViewType constants. |
olLargeIcon |
olSmallIcon |
expression.ViewType
expression Required. An expression that returns an OutlookBarGroup object.
ViewType property as it applies to the View object.
Returns an OlViewType constant that represents the type of the current view. Read-only.
OlViewType can be one of these OlViewType constants. |
olCalendarView |
olCardView |
olIconView |
olTableView |
olTimelineView |
expression.ViewType
expression Required. An expression that returns a View object.
Example
As it applies to the OutlookBarGroup object.
The following Microsoft Visual Basic/Visual Basic for Applications example toggles the first Outlook bar group between large and small icon views.
Dim myOlApp As New Outlook.Application
Dim myOlBar As Outlook.OutlookBarPane
Dim myOlGroup As Outlook.OutlookBarGroup
Set myOlBar = myOlApp.ActiveExplorer.Panes.Item("OutlookBar")
Set myOlGroup = myOlBar.Contents.Groups.Item(1)
If myOlGroup.ViewType = olLargeIcon Then
myOlGroup.ViewType = olSmallIcon
Else
myOlGroup.ViewType = olLargeIcon
End If
If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.
Set myOlBar = Application.ActiveExplorer.Panes.Item("OutlookBar")
Set myOlGroup = myOlBar.Contents.Groups.Item(1)
If myOlGroup.ViewType = 0 Then
myOlGroup.ViewType = 1
Else
myOlGroup.ViewType = 0
End If
As it applies to the View object.
The following example displays the name and type of all views in the user's inbox.
Sub DisplayViewMode()
'Displays the names and view modes for all views
Dim olApp As Outlook.Application
Dim objName As NameSpace
Dim objViews As Views
Dim objView As View
Dim strTypes As String
Set olApp = Outlook.Application
Set objName = olApp.GetNamespace("MAPI")
Set objViews = objName.GetDefaultFolder(olFolderInbox).Views
'Collect names and view types for all views
For Each objView In objViews
strTypes = strTypes & objView.Name & vbTab & vbTab & objView.ViewType & vbCr
Next objView
'Display message box
MsgBox "Current Inbox Views and Viewtypes:" & vbCr & _
vbCr & strTypes
End Sub