After cancelling an Outlook meeting, you may hope to auto delete the sent meeting cancellations from “Sent Items” folder. Now, in this article, we will teach you how to realize it with Outlook VBA.
Every time when you cancel an Outlook meeting which is organized by you, you’ll be requested to send a meeting cancellation to all its attendees. After sending the cancellation, the meeting will be auto deleted from calendar. Yet, the cancellation will be still in the “Sent Items” folder.
More often than not, since the cancellation is also useless for you, in order to keep your “Sent Items” folder clean, you may need to manually delete the sent cancellation. Under this circumstance, you would long for methods to let Outlook auto accomplish it. Thereinafter, we will teach you how to achieve it via VBA. As for how to use VBA, you can refer to “How to Run VBA Code in Your Outlook“.
Auto Delete Sent Meeting Cancellations
- To begin with, go to Outlook VBA editor via “Alt + F11”.
- Then, copy the following VBA code into “ThisOutlookSession” project.
Public WithEvents objSentFolder As Outlook.Folder Public WithEvents objSentItems As Outlook.Items Private Sub Application_Startup() Set objSentFolder = Outlook.Application.Session.GetDefaultFolder(olFolderSentMail) Set objSentItems = objSentFolder.Items End Sub 'When a new item gets into "Sent Items" folder Private Sub objSentItems_ItemAdd(ByVal Item As Object) Dim objMeetingCancellation As Outlook.MeetingItem Dim objDeletedItems As Outlook.Items 'If the new item is Meeting Cancellation If TypeOf Item Is MeetingItem And Left(Item.Subject, 9) = "Canceled:" Then Set objMeetingCancellation = Item 'Delete it objMeetingCancellation.Delete 'Delete it from "Deleted Items" folder, too Set objDeletedItems = objSentFolder.Parent.Folders("Deleted Items").Items For Each objItem In objDeletedItems If TypeOf objItem Is MeetingItem And Left(objItem.Subject, 9) = "Canceled:" Then objItem.Delete End If Next End If End Sub
- After that, move your cursor to the “Application_Startup” subroutine.
- Later, press “F5” key button to activate this macro.
- From now on, every time when you send out a meeting cancellation, it will be deleted permanently from your Outlook.
Resolve Outlook Problems as Soon as Possible
Despite containing a lot of excellent features and fulfilling multiple users’ needs, Outlook has a serious downside – prone to errors and corruption. For instance, if you frequently shut down your Outlook abnormally, you may encounter Outlook corruption. To be specific, your PST file may be inaccessible. In such a case, you’d better deal with it as soon as possible. Firstly, you need to check if there is a valid and updated PST backup. If there isn’t, you ought to try Scanpst to repair the file. If the inbuilt tool also fails, you have no choice but to resort to a more robust tool, such as DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt sql and outlook repair software products. For more information visit www.datanumen.com