View.Copy method (Outlook)
Creates a new instance of a View object.
Syntax
expression.Copy (Name, SaveOption)
expression A variable that represents a View object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Name | Required | String | Represents the name of the new View object. |
SaveOption | Optional | OlViewSaveOption | The save option that defines the permissions of the View object. |
Example
The following Microsoft Visual Basic for Applications (VBA) example creates a copy of a view called "New Table View" and saves it in the current folder. To run this example, you need to first create a view called 'New Table View' programmatically or by using the Outlook user interface.
Sub CopyView()
'Copies a view
Dim objViews As Outlook.Views
Dim objNewView As Outlook.View
Set objViews = _
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Views
'Create copy of View object
Set objNewView = objViews("New Table View").Copy(Name:="Table View Copy", _
SaveOption:=olViewSaveOptionThisFolderEveryone)
End Sub
See also
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.