VBA: Send Multiple Pictures in Outlook Email with Excel

VBA & macros · Updated November 18, 2026

Yes. In Excel for Microsoft 365 on Windows, VBA can create an Outlook email and add several picture files as attachments; it can also embed images in the message body. The example below attaches two files and opens the message for review before you send it.

What VBA can do

Excel VBA can automate the classic Outlook desktop app through Outlook’s object model. A macro can create a message, fill in recipients and a subject, add picture files from disk, and display the draft or send it. This is useful for repeatable tasks such as emailing a set of product photos, inspection images, or report illustrations.

There are two different ways to include pictures. An attachment appears as a file the recipient can open or save. An inline image is displayed within the message body, usually alongside explanatory text. Both approaches use the same local image files, but inline images need extra setup so the HTML message can refer to each attachment.

The code here is for Excel VBA on Windows with classic Outlook installed and configured. It uses late binding, so it does not require you to add an Outlook reference in the VBA editor. That convenience does not make it cross-platform: Excel for the web cannot run VBA, and the Outlook automation shown here is not supported by the new Outlook for Windows.

Prepare Excel and Outlook

First, confirm that Outlook desktop is available on the computer and that a mail account is set up. Save the workbook as an Excel Macro-Enabled Workbook (.xlsm) if you want to keep the macro. In Excel, open the Visual Basic Editor with Alt+F11 on Windows, choose Insert > Module, and put the code in that standard module. The Mac shortcut is Option+F11 on many keyboards; depending on the keyboard, you may also need Fn. The Outlook automation code below is Windows-specific even if the Visual Basic Editor is available on a Mac.

Before running any macro, save a separate copy of the workbook. VBA changes cannot be undone with Ctrl+Z, and a macro can send email or access files. Use trusted workbooks and do not lower macro security globally just to run an unfamiliar file. Outlook or an organization’s security policy may also restrict automated sending.

Attach several picture files

This macro adds two example image files from the current Windows user’s Pictures folder. Change the filenames, recipient, subject, and message for your use. It checks that each path exists before adding the file. The draft opens for a final check; it does not send automatically.

Option Explicit

Sub SendPicturesAsAttachments()
    Dim olApp As Object
    Dim olMail As Object
    Dim picturePaths As Variant
    Dim filePath As String
    Dim i As Long

    ' Replace these sample filenames with your image filenames.
    picturePaths = Array( _
        Environ$("USERPROFILE") & Chr$(92) & "Pictures" & Chr$(92) & "first.jpg", _
        Environ$("USERPROFILE") & Chr$(92) & "Pictures" & Chr$(92) & "second.png")

    Set olApp = CreateObject("Outlook.Application")
    Set olMail = olApp.CreateItem(0)

    With olMail
        .To = "recipient@example.com"
        .Subject = "Pictures for review"
        .Body = "Hello," & vbCrLf & vbCrLf & _
                "Please see the attached pictures."

        For i = LBound(picturePaths) To UBound(picturePaths)
            filePath = CStr(picturePaths(i))
            If Len(Dir$(filePath)) = 0 Then
                MsgBox "File not found: " & filePath, vbExclamation
                Exit Sub
            End If
            .Attachments.Add filePath
        Next i

        .Display
    End With

    Set olMail = Nothing
    Set olApp = Nothing
End Sub

The number in CreateItem(0) identifies an Outlook mail item. The Attachments.Add line adds one file each time the loop runs, and the array supplies the file paths. Add more entries to the array for more pictures. The sample paths use Chr$(92) to create a Windows backslash without putting a backslash in the code’s displayed path.

Set recipients, paths, and sending behavior

Replace the sample email address with the intended recipient. For several recipients, Outlook’s .To property accepts semicolon-separated addresses, though using Outlook’s recipient collection is preferable when you need to resolve names against an address book or assign To, Cc, and Bcc separately. A recipient address in code is not proof that the correct person will receive the message, so inspect it in the draft.

Image paths can be hard-coded, read from worksheet cells, or assembled from a folder and filename. If paths come from cells, validate that each cell contains a usable path before trying to attach it. A relative path can depend on Excel’s current working folder, which may differ from the workbook’s folder; a full path is usually less ambiguous. Common image formats such as JPG and PNG are normally suitable, but file size and recipient mail limits still matter.

To send without displaying a draft, replace .Display with .Send. Do that only after checking the recipients, paths, body, and attachments with a test message. A sent email may not be recoverable, and a loop that sends messages to many people needs safeguards against duplicate or unintended delivery. The safer starting point is to display each message for review.

Embed images in the message body

If the recipient should see a picture between paragraphs rather than open an attachment, create an HTML message and associate each attached image with a content ID. The HTML uses a cid: reference that matches the ID assigned to the attachment. The following compact example builds one image element per file and displays the resulting draft.

Option Explicit

Sub SendInlinePictures()
    Dim olApp As Object
    Dim olMail As Object
    Dim olAttachment As Object
    Dim propAccessor As Object
    Dim picturePaths As Variant
    Dim filePath As String
    Dim contentId As String
    Dim imageHtml As String
    Dim i As Long

    picturePaths = Array( _
        Environ$("USERPROFILE") & Chr$(92) & "Pictures" & Chr$(92) & "first.jpg", _
        Environ$("USERPROFILE") & Chr$(92) & "Pictures" & Chr$(92) & "second.png")

    Set olApp = CreateObject("Outlook.Application")
    Set olMail = olApp.CreateItem(0)
    imageHtml = ""

    With olMail
        .To = "recipient@example.com"
        .Subject = "Pictures for review"

        For i = LBound(picturePaths) To UBound(picturePaths)
            filePath = CStr(picturePaths(i))
            If Len(Dir$(filePath)) = 0 Then
                MsgBox "File not found: " & filePath, vbExclamation
                Exit Sub
            End If

            Set olAttachment = .Attachments.Add(filePath, 1)
            contentId = "picture" & CStr(i) & "@example.local"
            Set propAccessor = olAttachment.PropertyAccessor
            propAccessor.SetProperty _
                "http://schemas.microsoft.com/mapi/proptag/0x3712001F", _
                contentId
            imageHtml = imageHtml & _
                "<p><img src='cid:" & contentId & _
                "' alt='Picture " & CStr(i) & "'></p>"
        Next i

        .HTMLBody = "<html><body><p>Please see the pictures:</p>" & _
                    imageHtml & "</body></html>"
        .Display
    End With

    Set propAccessor = Nothing
    Set olAttachment = Nothing
    Set olMail = Nothing
    Set olApp = Nothing
End Sub

This technique relies on Outlook’s MAPI property accessor and HTML rendering, so it is more sensitive to mail clients than ordinary attachments. The recipient’s email program may display inline images differently, block remote content, or show the image attachments separately as well. The sample assigns a distinct content ID to each picture; if you adapt it, keep every ID unique within that message.

Choose attachments or inline images

  • Use attachments when recipients need original files, when the pictures should be easy to save, or when the email client’s HTML display cannot be assumed.
  • Use inline images when the message needs a visual sequence, such as a labeled set of steps or a short visual report. Add explanatory text and meaningful alternative text where practical.
  • Use both only when there is a reason for recipients to see the image in the body and also retain the file. Inline images are commonly carried as attachments behind the scenes, so adding a second copy explicitly can create confusing duplicates.

Images can make a message large, especially when several high-resolution photos are included. Consider resizing or compressing copies when the recipient does not need the camera originals. Do not overwrite source photos just to reduce email size; work on copies and check the result at the intended display size.

Common problems and fixes

  • File not found: Check spelling, extension, folder, and whether the file is stored locally. A cloud placeholder may not be downloaded yet. The sample’s check reports the first missing path rather than silently skipping it.
  • Outlook cannot be created: Confirm that classic Outlook is installed, set up, and available to the same Windows user. The new Outlook app does not provide the classic Outlook COM automation interface used by this example.
  • A security prompt appears or sending is blocked: Outlook security settings, antivirus status, or workplace policy can affect programmatic access. Follow the organization’s approved process; do not try to bypass a managed security control.
  • The picture is attached but not shown in the body: Confirm that the HTML cid: text exactly matches the content ID set on that attachment. Some clients display attached files differently, so test with the actual recipient’s mail environment when inline placement matters.
  • The email is too large: Reduce image dimensions or send a secure shared link if your organization permits it. A cloud link is not the same as an attachment: recipients may need access permissions and an internet connection.

Platform and workflow alternatives

This example targets Excel VBA controlling classic Outlook on Windows. The new Outlook for Windows does not support VBA macros or the same COM automation model, so these procedures will not work there as written. Excel for the web does not run VBA macros. Outlook on Mac has a different automation environment; do not assume that Windows Outlook object-model code can control it.

If a Windows desktop macro is not an option, consider a supported organizational workflow such as Power Automate, or create the message manually in Outlook and attach the files. For high-volume or unattended email, use an approved service designed for that purpose rather than relying on a desktop session and an interactive Outlook profile. Any alternative still needs recipient validation, access controls, and a way to handle failures.

Frequently Asked Questions

Can VBA send multiple pictures in one email?

Yes. Add each picture path to an array and loop through it with Attachments.Add, as in the first example. All of the files are added to the same message item.

Can I send pictures without opening the email draft?

Yes. Change .Display to .Send after thoroughly testing the macro. Sending immediately removes the draft-review step, so validate recipients and attachments before enabling that behavior.

How do I put pictures inside the email instead of attaching them?

Use an HTML body and give each image attachment a content ID, then refer to that ID with an HTML img element using src='cid:...'. The inline example shows the basic pattern, but render results can vary between email clients.

Will this macro work with the new Outlook for Windows?

No, not as written. It uses classic Outlook’s COM object model. Use classic Outlook on Windows for this automation, or choose a different supported workflow if classic Outlook is unavailable.

Why does Outlook show a warning when VBA tries to send mail?

Outlook may apply programmatic-access protections, and an organization can impose additional controls. The exact behavior depends on the Outlook and security configuration. Ask an administrator about approved options rather than disabling protections broadly.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.