When composing an Outlook mail, if you wish to quickly replace all the occurrences of a specific text with a specific image, you can use either of the 2 means shared in this article.
For some reasons, you may need to find all the occurrences of a specific text in an email and batch replace them with a specific picture. Some users think that this seems impossible. Actually, it can be easily achieved either via “Find and Replace” function or Outlook VBA code. In the followings, we will introduce them in detail.
Method 1: Use “Find and Replace” Function
- At the very outset, in the source email window, you should switch to “Insert” tab and click “Picture”.
- In the new popup dialog box, select the specific image and hit “Insert”.
- After the image is inserted in the message body, select it and press “Ctrl + C” key button to copy it.
- Subsequently, you can delete the inserted image.
- Later, shift to “Format Text” tab and click “Replace” in “Editing” group.
- Next, in the popup “Find and Replace” dialog box, do the following steps:
- First off, type the specific text in the “Find what” field.
- Then, input “^c” in the “Replace with” field.
- Lastly, click “Replace All” button.
- At once, you will find that all the occurrences of the specific text have been replaced with the specific image.
Method 2: Apply Outlook VBA Code
- For a start, keep the source email opened.
- Then, access VBA editor by referring to the article – “How to Run VBA Code in Your Outlook”.
- In the new window, enable “MS Word Object Library” according to the article – “How to Add an Object Library Reference in VBA”.
- Next, copy the VBA code below into an empty module.
Sub ReplaceSpecificTextWithSpecificImage() Dim objMail As Outlook.MailItem Dim objMailDocument As Word.Document Dim objWordApp As Word.Application Dim strText As String Dim strImageFile As String On Error Resume Next Set objMail = Outlook.Application.ActiveInspector.CurrentItem Set objMailDocument = objMail.GetInspector.WordEditor Set objWordApp = objMailDocument.Application 'Change the specific text and the image file path strText = "DataNumen, Inc." strImageFile = "E:\DataNumen Products\Logo(thumbnail).jpg" With objWordApp.Selection .HomeKey Unit:=wdStory With .Find .ClearFormatting .Replacement.ClearFormatting .Text = strText Do While .Execute objWordApp.Selection.MoveRight objWordApp.Selection.InlineShapes.AddPicture FileName:=strImageFile, LinkToFile:=False, SaveWithDocument:=True Loop .Replacement.Text = "" .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With End With End Sub
- Ultimately, press “F5” key button to run this macro.
- After macro completes, close the editor window.
- Now, you can check the source email, in which the occurrences of the specific text must have been replaced with the specific picture.
Don’t Look Down Upon Small Errors in Outlook
Maybe you have been subject to diverse Outlook issues. To be honest, it is almost impossible to predict errors in Outlook effectively. At best, small errors can be solved by a simple restart. Yet, if the troubles are much more complex than what you think, leaving them aside will keep your Outlook file in danger. Therefore, it’s suggested to eliminate the errors as soon as possible. Thus, you’d better get hold of a potent and reliable PST fix tool, such as DataNumen Outlook Repair. It is able to fix PST issues in a jiffy.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt sql and outlook repair software products. For more information visit www.datanumen.com