How to Batch Find & Replace Specific Words in All Outlook Folder Names

At times, you may batch rename multiple Outlook folders by finding and replacing specific words in their names. This article will teach you how to quickly accomplish it by using Outlook VBA.

Batch Find & Replace Specific Words in All Outlook Folder NamesTo better organize your emails, you must have created a lot of custom folders in your Outlook. Faced with so many customized folders, at times, for some reasons, such as superior’s requirements or your changing preferences, you may want to rename these folders. Most of time, perhaps you simply would like to replace or remove the specific words in the folder names.

In general, to rename a folder, you can just pitch on and right click on it. Then in right clicking menu, select “Rename Folder”. Next input the new name. It is handy if you just want to rename two or three folders. But if you would like to find and replace the specific words in the names of all Outlook folders, manually doing it is very tedious. Hence, we’ll recommend you another quick way in the followings.

Batch Find & Replace Specific Words in All Outlook Folder Names

  1. At the very outset, start your Outlook program.
  2. Then press “Alt + F11” key buttons in main Outlook window.
  3. Next in the Outlook VBA editor window, open a module which is not used.
  4. Subsequently, copy the following VBA codes into this module window.
Public strFind, strReplace As String

Private Sub FindReplaceWordsinFolderNames()
    Dim objFolders As Outlook.Folders
    Dim objFolder As Outlook.Folder
 
    Set objFolders = Outlook.Application.Session.Folders("Personal").Folders
 
    'You need to input the specific words for find and replace
    strFind = InputBox("Enter the specific words you want to change.")
    strReplace = InputBox("Enter the specific words you want to change to. (Case Sensitive)")
 
    For Each objFolder In objFolders
        Call ProcessFolders(objFolder)
    Next
 
    MsgBox "Complete!", vbExclamation, "Rename Folders"
End Sub
 
Private Sub ProcessFolders(ByVal objCurrentFolder As Outlook.Folder)
    Dim objSubfolder As Outlook.Folder
 
    On Error Resume Next
    If InStr(LCase(objCurrentFolder.Name), LCase(strFind)) > 0 Then
       'Find and replace the specific words
       objCurrentFolder.Name = Replace(LCase(objCurrentFolder.Name), LCase(strFind), strReplace)
    End If
 
    'Process all folders recursively
    If objCurrentFolder.Folders.Count > 0 Then
       For Each objSubfolder In objCurrentFolder.Folders
           Call ProcessFolders(objSubfolder)
       Next
    End If
End Sub

VBA Code - Batch Find & Replace Specific Words in All Outlook Folder Names

  1. After that, you should ensure that macro is allowed in your Outlook.
  2. Finally, you can click the “Run” icon in the toolbar and press F5 key to trigger the new macro.
  3. After that, you will need to input the specific words for find and replace.Input the specific words for find and replace
  4. At once, all the specific words in Outlook folder names will be replaced, like the following screenshot:Specific Words Get Replaced

Tackle Distressing PST Data Troubles

When it comes to PST issues, such as various PST errors or inaccessible PST file, almost everyone will feel panic and tend to avoid this topic. However, it is pretty common in Outlook. So as to avoid such PST issues effectively, you’d better back up your PST file periodically. Moreover, it is also suggested to keep a potent PST repair tool in vicinity, like 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 repair sql and outlook repair software products. For more information visit www.datanumen.com

2 responses to “How to Batch Find & Replace Specific Words in All Outlook Folder Names”

  1. KrojamSoft BatchRename only applies to files and folder IN WINDOWS, not in Outlook, as far as I can see. So that leaves the aboveVBS script very useful, in my eyes.

Leave a Reply

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