Remove Method
Collapse the table of content
Expand the table of content

Views.Remove Method (Outlook)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Removes an object from the collection.

expression .RemoveIndex

expression A variable that represents a Views object.

Parameters

Name

Required/Optional

Data Type

Description

Index

Required

Variant

The name or 1-based index value of an object within a collection.

The following example removes a View object from the Views collection.

Sub DeleteView() 
 
 'Deletes a view from the collection 
 
 Dim objName As Outlook.NameSpace 
 
 Dim objViews As Outlook.Views 
 
 Dim objView As Outlook.View 
 
 Dim strName As String 
 
 
 
 strName = "New Icon View" 
 
 Set objName = Application.GetNamespace("MAPI") 
 
 Set objViews = objName.GetDefaultFolder(olFolderNotes).Views 
 
 For Each objView In objViews 
 
 If objView.Name = strName Then 
 
 objViews.Remove (strName) 
 
 End If 
 
 Next objView 
 
End Sub

Concepts

Other resources

Show:
© 2016 Microsoft