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 |
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