Sdílet prostřednictvím


FolderRemove Event

Occurs when a folder is removed from the specified Folders collection. This event is not available in Microsoft Visual Basic Scripting Edition (VBScript).

Subobject**_FolderRemove()**

*object   * An expression that evaluates to a Folders collection object.

Example

The following Microsoft Visual Basic/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 myolapp As New Outlook.Application
Dim myNS As Outlook.NameSpace
Dim WithEvents myFolders As Outlook.Folders

Sub Initialize_handler()
    Set myNS = myolapp.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

Applies to | Folders Object

See Also | FolderAdd Event | FolderChange Event | FolderSwitch Event | MAPIFolder Object | Using events with Automation