Embed Pictures in an Outlook Email using VBA Code

This blog post will guide you through using VBA (Visual Basic for Applications) in Outlook to embed pictures in your emails, making your messages more impactful and visually appealing.

VBA Code to Embed Pictures in an Email

Sub EmbedPictureInEmail()
    Dim myMail As MailItem
    Set myMail = Application.CreateItem(olMailItem)
    With myMail
        .To = "recipient@example.com"
        .Subject = "Subject of Your Email"
        .HTMLBody = "<html><body><img src='C:\path\to\your\image.jpg'></body></html>" & .HTMLBody
    End With
End Sub

Understanding the VBA Code

  1. Create a New Mail Item: The script initiates by defining a new mail item (myMail).
  2. Set Recipient and Subject: It specifies the recipient’s email address and the subject of the email.
  3. Embed the Image: The .HTMLBody property is used to embed the image. Replace 'C:\path\to\your\image.jpg' with the actual path to the image file of your computer.
  4. Display the Email: Finally, the .Display method opens the email window for viewing and editing.

How to Implement the VBA Code in Outlook

  • Access VBA Editor: Press Alt + F11 [Keyboard Shortcut] to open Outlook, or click on the development tab from the ribbon.
  • Click on Visual Basic to open the VBA editor.
  • Insert a New Module: Right-click on ThisOutlookSession, choose Insert, then Module.
  • Copy and Paste the Code: Enter the provided VBA script into the new module.
  • Save and Close: Save your work and exit the editor.

Why Use VBA to Embed Pictures in Emails?


  • Personalization: Tailors emails with specific images, enhancing the message’s impact.
  • Automation: Automates the process for regular email updates, saving time.
  • Consistency: Ensures uniformity in emails sent, maintaining a professional appearance.


  • Technical Knowledge Required: Users need a basic understanding of VBA.
  • Setup Time: Initial setup and testing of the script can be time-consuming.
  • Compatibility Issues: Embedded images might display differently across various email clients.


In conclusion, embedding images in emails using VBA in Outlook is a powerful way to enhance your communication.

I particularly favor the VBA code macro for embedding images in Outlook emails.

This preference stems mainly from the fact that there’s no direct keyboard shortcut available in Outlook for embedding images, making this macro incredibly useful and efficient for this purpose.

Executing the VBA Script

  1. Restart Outlook: To ensure the script is ready.
  2. Run the Script: Press Alt + F8, select EmbedPictureInEmail, and click ‘Run’.
  3. Finalize Your Email: The email window will open with the image embedded, ready for any final touches.

Related Articles