Muokkaa

Jaa


Views.Remove method (Outlook)

Removes an object from the collection.

Syntax

expression.Remove (Index)

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.

Example

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

See also

Views Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.