Views.ViewRemove event (Outlook)
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 | View | 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
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.