How to Batch Empty All “Deleted Items” Folders in All Your Outlook Email Accounts

If you’ve configured several email accounts in your Outlook and each account uses a separate Outlook data file, you will have several “Deleted Items” folders. When you want to empty each “Deleted Items” folder in every email account, you can utilize the piece of VBA code in this article. It permits you to empty them in bulk.

As we all know, Outlook allows users to add and configure several email accounts. Plus, if each account uses an individual Outlook data file, every file will come with a “Deleted Items” folder, which is storing the items have been deleted. When you confirm that the items in all the “Deleted Items” folders are useless, you’ll tend to empty the folders. In this case, if you manually empty them, it can be very tedious. You’re better off applying a tip to batch empty them, like the following one.

Batch Empty All "Deleted Items" Folders in All Your Outlook Email Accounts

Batch Empty All “Deleted Items” Folders in All Email Accounts

  1. At the very outset, launch your Outlook program.
  2. Then press “Alt + F11” key buttons in the main Outlook window.
  3. Next in the “Microsoft Visual Basic for Applications” window, you need open a blank module.
  4. Subsequently, copy and paste the following VBA codes into this module.
Sub BatchEmptyAllDeletedItemsFolder()
    Dim objStores As Outlook.Stores
    Dim objStore As Outlook.Store
    Dim objPSTFile As Outlook.Folder
    Dim objFolders As Outlook.folders
    Dim objFolder As Object
 
    Set objStores = Outlook.Application.Session.Stores
 
    'Process all Outlook PST files in your Outlook
    For Each objStore In objStores
        Set objPSTFile = objStore.GetRootFolder
        For Each objFolder In objPSTFile.folders
            Call ProcessFolders(objFolder)
        Next
    Next
End Sub

Sub ProcessFolders(ByVal objCurrentFolder As Outlook.Folder)
    Dim i, n As Long
 
    If objCurrentFolder.Name = "Deleted Items" Then
       'Delete all the items in "Deleted Items" folder
       For i = objCurrentFolder.Items.Count To 1 Step -1
           objCurrentFolder.Items.Item(i).Delete
 
           'Delete all the subfolders under "Deleted Items" folder
           For n = objCurrentFolder.folders.Count To 1 Step -1
               objCurrentFolder.folders.Item(n).Delete
           Next
       Next
    End If
End Sub

VBA Code - Batch Empty All "Deleted Items" Folders in All Your Outlook Email Accounts

  1. After that, you should check your Outlook macro settings, making sure that macros are permitted in your Outlook.
  2. Eventually, you can go back to the module and press “F5” key button to run this macro.
  3. After the macro running, you can see that all the “Deleted Items” folders have been emptied successfully.

In the Event of Outlook Corruption

Have you ever encountered Outlook crash or even Outlook corruption? In general, how will you deal with the terrible cases? If you have used Outlook for decades, it is inevitable to meet up with various issues in your Outlook. Therefore, you had better keep some repair and recovery ways in your mind, such as using the inbox repair tool, backing up Outlook data regularly, getting hold of a robust Outlook fix tool, etc. With all these precautions, even when your PST file gets compromised, you still can keep calm and easily find back your Outlook data.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including fix sql and outlook repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *