How to Add an Attachment to a Word Mail Merge

How-to basics · Updated November 3, 2026

How to Add an Attachment to a Word Mail Merge

To add a different attachment to each Word mail-merge email, put each recipient’s file path in your data source, then use a Word VBA macro to create an Outlook message for each row and attach its file. Word’s built-in Finish & Merge > Send E-mail Messages command does not include an attachment option. The steps below are for Word and classic Outlook on Windows; the macro opens messages for review rather than sending them automatically.

What You’ll Need

  • Microsoft Word for Microsoft 365 on Windows and classic Outlook for Windows, set up with the account you plan to send from. The macro uses Outlook’s desktop automation, which is not supported the same way in New Outlook.
  • A Word mail-merge main document connected to a recipient list, such as an Excel workbook. The list needs an email-address column named Email and a column named AttachmentPath.
  • The attachment files saved in a location your computer can access. Each path should identify one file, for example C:\\MailMergeFiles\\Invoice-1042.pdf.
  • A backup copy of your Word document and recipient list. The macro creates messages and cannot be undone with Ctrl+Z.

Step-by-Step

  1. Prepare the recipient list. In Excel, use one row per recipient and make the first row the column headings. Add an Email column containing each recipient’s address and an AttachmentPath column containing the full path to the file for that person. For example, a row might contain alex@example.com and C:\\MailMergeFiles\\Alex-Statement.pdf. Save and close the workbook before connecting or refreshing it in Word. Avoid putting multiple file paths in one cell; this macro attaches one file per row.
  2. Check every file path. In File Explorer, confirm that each listed file exists and opens. A full local path or an accessible network path is more reliable than a relative path. If the files are on a shared drive, make sure the computer running Word can access that drive under the same Windows account. Keep the paths free of accidental leading or trailing spaces.
  3. Connect the list to your Word document. Open your merge document. If it is not connected yet, go to Mailings > Select Recipients > Use an Existing List, choose the Excel workbook, and select the correct worksheet. Insert personalization fields from Mailings > Insert Merge Field where needed. The email-address and path columns are read by the macro; they do not have to appear in the message text.
  4. Test the normal merge content. Use Mailings > Preview Results and the record navigation controls to inspect several recipients. Check spelling, names, dates, and any conditional text. The macro uses each record’s merged document as the email body, so errors in the merge template will carry into the messages.
  5. Save a working copy as a macro-enabled document. Choose File > Save As and select Word Macro-Enabled Document (*.docm). Work on the copy, not your only original. Do not enable macros in a document from an untrusted source.
  6. Open the Visual Basic editor. If the Developer tab is not visible, enable it through File > Options > Customize Ribbon, select Developer, and choose OK. Then go to Developer > Visual Basic. In the editor, choose Insert > Module and paste the macro below into the new module.
  7. Match the field names and message details. The code expects headings exactly named Email and AttachmentPath. If your headings differ, change the two names in the DataFields lines to match them. Replace Your requested file with the subject you want. The macro puts the merged document’s text into the message as plain text; it does not preserve Word formatting.
  8. Run the macro on a small test list first. Close the Visual Basic editor, return to the merge document, and choose Developer > Macros. Select CreateMailMergeEmailsWithAttachments and choose Run. The macro checks that each row has an email address and an existing attachment. If it finds a missing value or file, it stops and reports the row number.
  9. Review the messages Outlook creates. The macro opens a separate Outlook message for each recipient; it does not send them. Check the To line, subject, merged message body, and attached filename on the test messages. Close test messages without sending if anything is wrong, correct the list or template, and rerun with a fresh test.
  10. Run the complete list and send deliberately. Once the test is correct, run the macro on the full list. Review the generated messages and send them in Outlook when ready. For a large mailing, consider working in manageable batches so you can check the results and avoid creating more open messages than your computer can handle.
Sub CreateMailMergeEmailsWithAttachments()
    Dim mainDoc As Document
    Dim mergedDoc As Document
    Dim ds As MailMergeDataSource
    Dim outlookApp As Object
    Dim mail As Object
    Dim i As Long
    Dim total As Long
    Dim emailAddress As String
    Dim attachmentPath As String

    Set mainDoc = ActiveDocument
    Set ds = mainDoc.MailMerge.DataSource
    total = ds.RecordCount

    If total < 1 Then
        MsgBox "No recipient records were found."
        Exit Sub
    End If

    Set outlookApp = CreateObject("Outlook.Application")

    For i = 1 To total
        ds.ActiveRecord = i
        emailAddress = Trim$(ds.DataFields("Email").Value)
        attachmentPath = Trim$(ds.DataFields("AttachmentPath").Value)

        If emailAddress = "" Or attachmentPath = "" _
           Or Dir$(attachmentPath) = "" Then
            MsgBox "Check the email address and attachment path in row " & i & "."
            mainDoc.Activate
            Exit Sub
        End If

        With mainDoc.MailMerge
            .Destination = wdSendToNewDocument
            .DataSource.FirstRecord = i
            .DataSource.LastRecord = i
            .Execute Pause:=False
        End With

        Set mergedDoc = ActiveDocument
        Set mail = outlookApp.CreateItem(0)
        With mail
            .To = emailAddress
            .Subject = "Your requested file"
            .Body = mergedDoc.Content.Text
            .Attachments.Add attachmentPath
            .Display
        End With

        mergedDoc.Close SaveChanges:=wdDoNotSaveChanges
        mainDoc.Activate
    Next i

    MsgBox "Messages are open in Outlook for review. They have not been sent."
End Sub

The macro relies on the merge data source being connected and on Outlook being available. It creates one message per row and attaches the file named on that row. It intentionally uses .Display, not an automatic send command, so you can inspect the results. After you have verified the messages, send them using Outlook. If you need formatted HTML in the email body, this plain-text example is not sufficient; use an email-merge add-in that supports attachments and formatted messages, or have a developer adapt the automation.

Common Mistakes

  • Looking for an attachment button in Word’s email-merge dialog. The built-in send-email merge sends the merged content but has no control for attaching a file. Use the automation approach above, an appropriate add-in, or send messages individually.
  • Using a filename instead of a full path. A value such as Invoice.pdf may not tell Word where to find the file. Include the drive and folder, or a valid network location.
  • Using different column headings from the code. Field names must match exactly. A heading such as Email Address will not work until the code’s Email reference is changed to that heading.
  • Putting several recipients in one row. This macro is designed to create one message per data record and attach one file per record. Separate recipients into separate rows, especially when the attachments contain private information.
  • Assuming the macro sends messages. It opens draft messages in Outlook. You still need to inspect and send them. Conversely, do not change the display instruction to automatic sending until you have a safe, tested process.
  • Running it against the whole list before checking a sample. A mistaken path or merge field can create many incorrect drafts. Test with a few records and verify that each recipient gets the intended attachment.

Tips

  • Use clear, unique filenames and keep a simple mapping between recipient rows and files. This makes it easier to catch a mismatched attachment during review.
  • Send yourself a test message first. Use a test record with a file that is safe to share, then confirm that the received message contains the expected text and attachment.
  • Check attachment size and your organization’s email limits before creating a large batch. If files are too large, ask whether an approved secure sharing link is more suitable.
  • Keep sensitive files in access-controlled folders and verify the To address and attachment together. An accurate merge can still expose information if the spreadsheet pairs the wrong person with a file.
  • For a recurring process, document the required column headings, folder structure, subject line, and review steps. Do not rely on memory when preparing a later mailing.
  • On Windows, Ctrl+Z cannot reverse messages created by a macro. Close unwanted drafts, and restore the backed-up document or data list if you make an unintended change.

Troubleshooting

The macro says a file is missing. Check the reported row in Excel and compare the path with the file’s actual location. Make sure the extension is included, remove extra spaces, and confirm that a network share is connected. If File Explorer cannot open the path, Word cannot attach it either.

The macro cannot find a data field. Compare the column heading in the first row of the source workbook with the name inside DataFields. Correct either the heading or the code, save the workbook, and reconnect or refresh the recipient list if Word is showing old field names.

Outlook does not open, or automation fails. This method requires classic Outlook for Windows and an Outlook profile configured on the computer. New Outlook does not provide the same COM automation interface. If your organization only provides New Outlook or blocks macros, use an approved mail-merge add-in or another supported sending workflow instead.

The message body is unformatted or looks crowded. The sample macro assigns mergedDoc.Content.Text to Outlook’s plain-text body. Word font choices, bold text, tables, and other layout are not retained. For formatted mail, choose a tool that supports HTML mail merges with attachments rather than assuming this code preserves formatting.

The wrong message or attachment appears. Stop before sending. Check that the source rows are in the intended order, each email address and file path share the same row, and the template is using the intended merge fields. Run a small test again after fixing the data. If the macro has already opened drafts, close them without sending before creating a corrected batch.

Frequently Asked Questions

Can Word attach a file using its built-in email mail merge?
No. Word’s built-in Finish & Merge > Send E-mail Messages command does not offer an attachment field. A macro, compatible add-in, or individual Outlook messages are alternatives.

Can I attach a different file for every recipient?
Yes. Put the full path to each recipient’s file in that person’s row in the AttachmentPath column. The macro reads the path and adds that file to the corresponding message.

Can I attach the same file to every merged email?
Not with Word’s built-in email-merge dialog. You can use a macro or a mail-merge add-in that supports attachments. If you use the sample macro, each row needs the path to the file to attach; the same path can be repeated for all rows.

Will this work on a Mac?
The macro shown is written for Word and classic Outlook on Windows and uses Windows Outlook automation. Mac versions have different automation support, so use a Mac-compatible add-in or another supported method rather than expecting this code to run as written.

Does the macro send messages automatically?
No. It opens each message in Outlook for review. You must send the messages yourself. That is intentional, so you can catch incorrect recipients, merge text, or attachments before sending.

Can the sample preserve formatting from Word?
No. It copies the merged document as plain text. For HTML formatting, tables, or styled content, use a mail-merge tool that explicitly supports formatted email bodies and per-recipient attachments.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

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

Spotted an error in this guide? Let us know.