How to Batch Delete All Search Folders in Your Outlook

By default, Outlook doesn’t allow users to delete more than one search folder in one go, not to mention to bulk delete all search folders. But this article will share you a method, which can realize it.

Generally, to delete a search folder, you could right click one and choose “Delete Folder” option from its context menu. In this way, when you need to delete all of your search folders, you will surely think it pretty tedious and cumbersome. You must wish to delete all of them in one go. Thus, here we will introduce a means to you, which can help you accomplish the deletion in a jiffy.

Batch Delete All Search Folders in Your Outlook

Batch Delete All Search Folders

  1. At the very outset, you ought to launch your Outlook as normal.
  2. Then, after accessing the main Outlook screen, you have to press “Alt + F11” key buttons.
  3. At once, you’ll get into the “Microsoft Visual Basic for Applications’ window.
  4. Subsequently, you need to find and open a module which is not in use.
  5. Next, you could copy and paste the following VBA code into this module.
Sub BatchDeleteAllSearchFolders()
    Dim objStores As Outlook.Stores
    Dim objStore As Outlook.store
    Dim objSearchFolders As Outlook.Folders
    Dim objSearchFolder As Outlook.Folder

    On Error Resume Next
    Set objStores = Outlook.Application.Session.Stores
 
    For Each objStore In objStores
        'Get all search folders under each Outlook data file
        Set objSearchFolders = objStore.GetSearchFolders
        For Each objSearchFolder In objSearchFolders
            'Delete each search folder
            objSearchFolder.Delete
        Next
    Next
End Sub

VBA Code - Batch Delete All Search Folders in Your Outlook

Notes:

  • Perhaps you’ve configured several email accounts in your Outlook. And each one has its own PST files. In each file, you may create some search folders. By the above code, all search folders will be deleted, no matter what files they are located in.
  • If you would like to specify an Outlook data file, you could add the following line under “For each objStore In objStores”. Here you should change the “John Smith” to the display name of your own PST file.
If objStore.DisplayName = "John Smith" Then
 . . . . . . . . . . . . . . .
End If
  1. After that, you should change your Outlook macro security level to low.
  2. Eventually, in “Microsoft Visual Basic for Applications” window, to run this macro, you can click press F5 key button.
  3. After the macro finishes, you will find that all search folders in your Outlook have been deleted.

Safeguard Your Outlook Data

Due to the fact that Outlook is prone to corruption, you should make great efforts to keep Outlook data well-protected. Undoubtedly, one of the most vital ways is make consistent and up-to-date backup for your Outlook files. Furthermore, so as to offer immediate rescue in case of Outlook corruption, you had better prepare a cogent and reputable fix tool, such as DataNumen Outlook Repair.

Author Introduction:

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

2 responses to “How to Batch Delete All Search Folders in Your Outlook”

Leave a Reply

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