ViewAdd Event

Microsoft Outlook Visual Basic

ViewAdd Event

       

Occurs when a view is added to the collection. Microsoft Outlook creates the new view and passes it to this event.

 Sub expression_ViewAdd(ByVal View As View)

expression   A variable which references an object of type Views declared with events in a class module.

View   The new view added to the collection prior to this event.

Example

The following example displays the view's name and saves it. Use the Save method after the properties have been modified to save the changes to the view.

Sub tblView_ViewAdd(ByVal View As View)
'Displays name of new view

   With View
       Msgbox .Name & "Was created."
       .Save
   End With

End Sub