Share via


Folders.FolderRemove Event (Outlook)

Occurs when a folder is removed from the specified Folders collection.

Syntax

expression .FolderRemove

expression A variable that represents a Folders object.

Remarks

This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).

Example

The following Microsoft Visual Basic for Applications (VBA) example displays a warning message when the user tries to a delete a folder in the Inbox. The sample code must be placed in a class module, and the Initialize_handler routine must be called before the event procedure can be called by Microsoft Outlook.

Dim myNS As Outlook.NameSpace 
 
Dim WithEvents myFolders As Outlook.Folders 
 
 
 
Sub Initialize_handler() 
 
 Set myNS = Application.GetNamespace("MAPI") 
 
 Set myFolders = myNS.GetDefaultFolder(olFolderInbox).Folders 
 
End Sub 
 
 
 
Private Sub myFolders_FolderRemove() 
 
 MsgBox ("All the items in the folder are deleted as well.") 
 
End Sub

See Also

Concepts

Folders Object

Folders Object Members