How to Batch Find and Replace Text in Multiple Outlook Emails

By default, Outlook doesn’t support you to find and replace text in multiple emails at the same time. Therefore, if you want to do it, you can refer to this article. Here we will teach you how to realize it via VBA code.

For example, you have finished several emails in Outlook. Before you send them out, you discover some mistakes and want to modify some texts in these emails. In general, you have to perform ‘Find and Replace” in each email one by one. Yet, it’s too cumbersome. Thus here we’ll show you a more effective way, which can let you accomplish it in bulk.Batch Find and Replace Text in Multiple Outlook Emails

Batch Find and Replace Text in Multiple Emails

  1. To begin with, start your Outlook program.
  2. Then, access VBA editor via “Alt + F11” keys.
  3. In the new window, put the VBA code below into a module or project.
Sub FindReplaceInMultipleEmails()
    Dim strFind, strReplace As String
    Dim objInspectors As Outlook.Inspectors
    Dim objInspector As Outlook.Inspector
    Dim objMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
 
    'Enter the specific text
    strFind = InputBox("Enter the text for find: (Case Sensitive)")
    strReplace = InputBox("Enter the text for replacement: (Case Sensitive)")
 
    If Trim(strFind) <> "" Then
       Set objInspectors = Outlook.Application.Inspectors
 
       For Each objInspector In objInspectors
           If objInspector.CurrentItem.Class = olMail Then
              If objInspector.EditorType = olEditorWord Then
                 Set objMail = objInspector.CurrentItem
                 Set objMailDocument = objMail.GetInspector.WordEditor
 
                 'Find & replace specific text
                 With objMailDocument.Content.Find
                      .ClearFormatting
                      .Text = strFind
                      .Replacement.ClearFormatting
                      .Replacement.Text = strReplace
                      .Forward = True
                      .Wrap = wdFindContinue
                      .Format = False
                      .MatchCase = True
                      .MatchWholeWord = False
                      .Execute Replace:=wdReplaceAll
                End With
                objMail.Save
             End If
         End If
      Next
 
      MsgBox "Completed!", vbInformation + vbOKOnly
    End If
End Sub

Put Code into a Module

  1. After that, add this macro to Quick Access Toolbar according to “How to Run VBA Code in Your Outlook“.
  2. Subsequently, you can try this macro now.
  • Open the source emails.
  • Then, click macro button in Quick Access Toolbar.Run Macro
  • Next, you need to enter the specific texts to find and replace.Enter Specific Text
  • When you get the “Completed” prompt, you can check the source emails.Replaced Text in Multiple Emails

Restore Outlook from Unexpected Crashes

Outlook can crash now and then if you handle your Outlook improperly. What’s more, usually, in the event of severe Outlook crash, your Outlook file tends to be corrupt. At that time, you have to attempt Outlook data recovery. Of course, it will be considerably simple if you have an up-to-date data backup. But if not, you’d be required to apply a cogent and creditable external tool, like DataNumen Outlook Repair. It can fix PST file without breaking a sweat.

Author Introduction:

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

Comments are closed.