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 Emails
- To begin with, start your Outlook program.
- Then, access VBA editor via “Alt + F11” keys.
- 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
- After that, add this macro to Quick Access Toolbar according to “How to Run VBA Code in Your Outlook“.
- Subsequently, you can try this macro now.
- Open the source emails.
- Then, click macro button in Quick Access Toolbar.
- Next, you need to enter the specific texts to find and replace.
- When you get the “Completed” prompt, you can check the source 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
Is there a way of amending this to update all emails in an Outlook folder, without the need to individually open them ?
Is there any reason for declaring the strFind as a Variant rather than a String?