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
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for