Attaching pdf in mail merge

The joys of mail merge!

To attach a PDF file in a mail merge, you'll need to use a combination of Microsoft Word, Adobe Acrobat, and some clever formatting. Here's a step-by-step guide to help you achieve this:

Prerequisites:

  1. Microsoft Word 2010 or later version
  2. Adobe Acrobat DC or later version
  3. A PDF file you want to attach

Step 1: Prepare your PDF file

  1. Open your PDF file in Adobe Acrobat DC.
  2. Go to File > Save As and choose PDF as the file type.
  3. In the Save As PDF dialog box, select Attachments as the Save as type.
  4. Click Save to save the PDF file with attachments.

Step 2: Create a mail merge document in Microsoft Word

  1. Open Microsoft Word and create a new document or open an existing one.
  2. Go to Mailings > Start Mail Merge > Step-by-Step Mail Merge Wizard.
  3. Follow the wizard to set up your mail merge, including selecting a data source (e.g., an Excel spreadsheet).

Step 3: Insert the PDF file using a merge field

  1. In your Word document, place your cursor where you want to insert the PDF file.
  2. Go to Insert > Quick Parts > Field.
  3. In the Field dialog box, select Merge Field from the Categories list.
  4. Choose a merge field that corresponds to the data you want to use to attach the PDF file (e.g., a customer ID).
  5. Click OK to insert the merge field.

Step 4: Use a VBA script to attach the PDF file

  1. Open the Visual Basic Editor by pressing Alt + F11 or by navigating to Developer > Visual Basic.
  2. In the Visual Basic Editor, create a new module by clicking Insert > Module.
  3. Paste the following VBA script:
    Sub AttachPDF()
     Dim doc As Document
     Set doc = ActiveDocument
     Dim mergeField As MergeField
     Set mergeField = doc.Fields.Item("YourMergeField")
     Dim pdfPath As String
     pdfPath = "C:\Path\To\Your\PdfFile.pdf" ' Update this path with your PDF file location
     Dim attachment As Attachment
     Set attachment = doc.Attachments.Add(pdfPath)
     attachment.FileName = mergeField.Result
    End Sub

    Replace "YourMergeField" with the actual name of your merge field, and update the pdfPath variable with the location of your PDF file.

Step 5: Run the VBA script

  1. Close the Visual Basic Editor and return to your Word document.
  2. Go to Mailings > Finish & Merge > Edit Individual Documents.
  3. In the Edit Individual Documents dialog box, select Edit.
  4. Click Run to run the VBA script, which will attach the PDF file to each document based on the merge field values.

That's it! Your mail merge document should now include the attached PDF file.