ViewRemove Event
Occurs when a view has been removed from the specified collection.
Syntax
expression .ViewRemove(View)
expression A variable that represents a Views object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
View |
Required |
The view which was removed from the collection prior to this event. |
Example
The following Microsoft Visual Basic for Applications (VBA) example displays the name of the view that has been removed from the collection when the ViewRemove event is fired. The sample code must be placed in a class module such as ThisOutlookSession, and the DeleteView() procedure should be called before the event procedure can be called by Microsoft Outlook.
Public WithEvents objViews As Outlook.Views
Sub DeleteView()
Set objViews = Application.ActiveExplorer.CurrentFolder.Views
objViews.Item("New Table View").Delete
End Sub
Sub objViews_ViewRemove(ByVal View As View)
'Displays view name
MsgBox "The view: " & View.Name & " was removed programmatically."
End Sub