How to Batch Delete All Embedded Images with a Hyperlink in Your Outlook Email

So as to avoid clicking on the hyperlinks of the embedded images accidentally, you may want to delete all of such pictures in bulk. In this article, we will guide you how to achieve it in quick time. 

When reading an email that contains a lot of images in its body and some of the images also carry with a hyperlink, if you click on such a picture, you will open a web page in the default internet browser. Yet, most of time, this is not what you want. Thereby, so as to avoid such mistakes, you may hope to hide or delete such images. As for how to hide, you can refer to previous article – “How to Batch Hide All Embedded Images with a Hyperlink in Your Outlook Email“. If you would like to batch delete, just read on.

Batch Delete All Embedded Images with a Hyperlink

  1. At first, launch Outlook VBA editor with accordance to the post “How to Run VBA Code in Your Outlook“.
  2. Then, in the new window, add the reference to “MS Word Object Library” by reading “How to Add an Object Library Reference in VBA“.
  3. Next, copy and paste the following VBA code into a blank module.
Sub DeletePicturesWithHyperlink()
    Dim objMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objInlineShape As Word.InlineShape
    Dim objShape As Word.Document
 
    'Get the current email
    Set objMail = Outlook.Application.ActiveInspector.CurrentItem
    Set objMailDocument = objMail.GetInspector.WordEditor

    If objMailDocument.InlineShapes.Count > 0 Then
       For Each objInlineShape In objMailDocument.InlineShapes
           If Not (objInlineShape.Hyperlink Is Nothing) Then
              'Delete the inline shapes with a Hyperlink
              objInlineShape.Range.Delete
           End If
       Next
    End If
 
    If objMailDocument.Shapes.Count > 0 Then
       For Each objShape In objMailDocument.Shapes
           If Not (objShape.Hyperlink Is Nothing) Then
              'Delete the shapes with a Hyperlink
              objShape.Range.Delete
           End If
       Next
    End If
End Sub

VBA Code - Batch Delete All Embedded Images with a Hyperlink

  1. After that, add this macro to Quick Access Toolbar of Message window.
  2. Eventually, follow the steps below to try it.
  • For a start, open the source email.
  • Then, press the macro button in Quick Access Toolbar.
  • At once, all the pictures which carry with a hyperlink will be deleted, like the following figure.Delete Images with a Hyperlink

Deal with Outlook Problems Effectively

As we all know, it is a bit difficult to prevent Outlook problems. What we can do is to know some tips to deal with various Outlook issues. For instance, in case of the serious Outlook file corruption, you should check the most recent backups firstly. Then, if your Outlook data backup doesn’t contain your valuable data, your next step is to recover PST file. At that point, you can try the inbuilt fix tool in the first place. Assuming that it fails, your last resort is a professional and credible third party 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 damaged mdf and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.