How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Rojus Alappat Your Own Question
Rojus Alappat
Rojus Alappat, Computer Support Specialist
Category: Computer
Satisfied Customers: 512
Experience:  5+ Years of Experience as System Admin.
Type Your Computer Question Here...
Rojus Alappat is online now
A new question is answered every 9 seconds

In Word 2010, how can I attach a pdf document to a mail merge

This answer was rated:

In Word 2010, how can I attach a pdf document to a mail merge email? I'm running Windows 7, 64 bit.
Hi... Welcome to Just Answer Support...
I am Rojus... Hope I can assist you to solve this issue...

Please go through the following steps...

Many to one mail merge

The mail merge function in Microsoft Word works only with a flat data file as a one to one merge. There have been various approaches proposed to enable the merging of lists associated with each record - for example invoices where multiple items appear associated with each buyer. Microsoft's own suggested approach is quite complicated and recorded at How to use mail merge to create a list sorted by category

Fellow Word MVP Paul Edstein has posted a tutorial on this, with working field codes and a sample Excel data source which you can download from this web site but it can be a tad bewildering and even Paul would concede that creating this type of merge can be intimidating for those unskilled in mail merge.

To overcome this difficulty another Antipodean MVP and regular contributor to this site, Doug Robbins produced an add-in to attempt to simplify the process, which I have modified and added some further functionality. This page documents the use of the add-in.

The add-in is supplied in DOTM format for Word 2007/2010 and includes a modification to the Mailings Tab of the ribbon.

The add-in requires that the data source used for the merge to be in Excel format with Outlook to be the default e-mail application for Windows.


If there are likely to be some rows with no data in some of the fields, all of the cells that represent the data source must be formatted as text. Otherwise, errors can occur when the routine encounters a type of data that it is not expecting.

The data must be sorted by the field that is going to be used as the key field. Not sorting it that way will not cause an error, but the desired result will not be achieved.

The appropriate add-in should be should be extracted to the Word start-up folder. By default the start-up folder location is a hidden location, but it can easily be located by typing %appdata%\Microsoft\Word\Startup in the address bar of Windows Explorer or your browser. When Word is run the add-in will load and the calling command will be added to a custom toolbar or the mailings tab of the ribbon according to version.


For the purpose of explanation of the use of the add-in, a ample merge document and an Excel data source are included in the zip file. An extract of the relevant part of the merge document is included below.

The merge document must be set up as a conventional letter merge.

While testing the e-mail option(s) with the sample data source, configure Outlook not to send messages immediately!

The sample messages will then go to the outbox from where they can be deleted.

With the example document, the key field is OWNER and the child fields are PROP_ID and LEGAL_DESC.

The fields are inserted as shown in the upper illustration and the intended result is shown in the lower illustration of the two illustrations that immediately follow. Note that only one set of each of the “repeating” fields (PROP_ID and LEGAL_DESC) is required in each location where that data may be reproduced.

The next step is to run the macro. The macro is designed to work in conjunction with Outlook as the default email application. If the merge is going to be as the body of a mail merge message, and you have Outlook configured to spell check messages before sending, Then you will see the following warning as each message is sent:

With a data file of more than a few records, this will soon become extremely tedious, so before progressing further, the macro checks the registry to establish whether the spell check option is selected. As it is not possible to disable the spell check using the macro, If it is selected you are presented with the following dialog, which provides the option to cancel and change the setting manually, or to continue without the option to merge to the body of an e-mail message.


When merging to the body of an e-mail message, be aware that the html format used bears little relationship to your Word merge document, as the formatting requirements for Word document and html are entirely different. Ensure that the layout of the messages is correct (see the Word web view) before sending.

If the data source is detached or is of the wrong type of file, or if the merge document type is wrong the user will be presented with a warning message that explains the error i.e.

If all is well the macro presents a userform from which the key field and the repeating fields are selected:

Messages merged to e-mail

An extract from one of the completed messages

An accompanying message

While choosing the destination you should select df file instead of .dco file.

Hope this will help you... kindly let me know if you need further assistance...

1- Please click the ACCEPT button, so your deposit can be released and I can get paid for my effort. (*** Even if you have a subscription plan, you need to click the Accept button if the issue is solved for me to be paid, you won't be charged twice ***, don't worry. Thank you!)

2- Let me know if the answer doesn't work INSTEAD of leaving negative feedback, so we can still continue troubleshooting the issue.

3- Positive Feedback is very important to us. Please leave me a positive feedback if you are happy with the answer.

4- Any bonus will be greatly appreciated.
Customer: replied 6 years ago.
Dear Rojus,
I think I understand what you have. I do not have any problems setting up and sending multiple emails from Word 2010. My question is, how can I add an attachment to the separate emails. Please help.

Can you please try the following to merge with attachments...

Mail Merge to E-mail with Attachments

This procedure can be used to mail merge to e-mail, including attachments with each message when Microsoft Office Outlook is installed. It has been used with all versions of Office from Office 97 up to and including Office 2007. It is not necessary for Outlook to be nominated as the default mail program, but it must be installed on the system. The procedure can handle multiple attachments for each message, individual attachments for each recipient, common attachments for all recipients, or a mixture of both.


To run the macro in this procedure it is necessary to set a reference to the Microsoft Office Outlook Object Library. You do this from within the Visual Basic Editor, by selecting References from the Tool menu and then checking the item Microsoft Office Outlook ##.0 Object Library (where ## XXXXX XXXXX Outlook version number).

In addition, running the macro will cause the following warning message to be displayed by Outlook for each email message that the macro sends:

Warning that other program is attempting to send an email

You can avoid this happening by downloading the "Express ClickYes" utility that is available as a free download from:

Express ClickYes is a tiny program that sits in the taskbar and clicks the Yes button on behalf of you, when Outlook's Security Guard opens prompt dialog saying that a program is trying to send an email with Outlook or access its address book. You can suspend/resume it by double-clicking its taskbar icon. Developers can automate its behaviour by sending special messages.


You will need to create a separate Catalog (or in Word 2002 and later, Directory) type mail merge main document which creates a word document containing a table in each row of which would be data from the data source that contains the email address in the first column and the Drive:\Path\Filename of each attachment in the second and any subsequent columns, one attachment per cell.

The data source for this Catalog/Directory type mail merge must be the same data source as that which you have, or will use for creating the mail merge that you want to email with attachments.

I cannot emphasise too strongly that the path and filenames for the attachments must be IDENTICAL to the actual path and filenames. If they are not, the files will not be attached. A single space in the wrong place is all that it will take for the procedure to fail.

In the Catalog/Directory type mail merge main document, insert a one row table into the cells of which you insert the relevant merge fields from the data source, similar to the following:




If the same attachment(s) are to be sent to all of the recipients, and they are not included in the datasource, the Drive\Path\Filename of the attachment(s) can be typed directly in the cell(s) of the Catalogue/Directory mail merge main document in place of the <<Attachment>> fields. In this case, your main document would look like:



You can also have a mixture of a standard attachment for each recipient and an individual one by setting the main document up in the following fashion:




After creating this Catalog/Directory mail merge main document, execute the mail merge to a new document, which if you have set it up correctly will produce a document containing a table similar to the following with as many rows as there are records in the data source:

[email protected]



[email protected]



Or in the case of a common attachment for each recipient:

[email protected]


[email protected]


Save that file and close it. When you run the macro that is provided below, you will be asked to open that document, so remember the name that you have given to it and where you saved it.

Then execute to a new document the mail merge that you want to send out by email with the attachments and with the result of the execution of that mail merge on the screen, run a macro containing the following code. (This code is designed to be pasted into the VBA Editor: it is much easier to read if you do that!)

Sub emailmergewithattachments() Dim Source As Document, Maillist As Document, TempDoc As Document
Dim Datarange As Range
Dim i As Long, j As Long
Dim bStarted As Boolean
Dim oOutlookApp As Outlook.Application
Dim oItem As Outlook.MailItem
Dim mysubject As String, message As String, title As String Set Source = ActiveDocument ' Check if Outlook is running. If it is not, start Outlook
On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If ' Open the catalog mailmerge document
With Dialogs(wdDialogFileOpen)
End With
Set Maillist = ActiveDocument ' Show an input box asking the user for the subject to be inserted into the email messages
message = "Enter the subject to be used for each email message." ' Set prompt.
title = " Email Subject Input" ' Set title.
' Display message, title
mysubject = InputBox(message, title) ' Iterate through the Sections of the Source document and the rows of the catalog mailmerge document,
' extracting the information to be included in each email.
For j = 1 To Source.Sections.Count - 1
Set oItem = oOutlookApp.CreateItem(olMailItem)
With oItem
.Subject = mysubject
.Body = Source.Sections(j).Range.Text
Set Datarange = Maillist.Tables(1).Cell(j, 1).Range
Datarange.End = Datarange.End - 1
.To = Datarange
For i = 2 To Maillist.Tables(1).Columns.Count
Set Datarange = Maillist.Tables(1).Cell(j, i).Range
Datarange.End = Datarange.End - 1
.Attachments.Add Trim(Datarange.Text), olByValue, 1
Next i
End With
Set oItem = Nothing
Next j
Maillist.Close wdDoNotSaveChanges ' Close Outlook if it was started by this macro.
If bStarted Then
End If MsgBox Source.Sections.Count - 1 & " messages have been sent." 'Clean up
Set oOutlookApp = Nothing End Sub

If you are not sure what to do with the above code, see the article "What do I do with macros sent to me by other newsgroup readers to help me out?” at:
Rojus Alappat and 9 other Computer Specialists are ready to help you
Customer: replied 6 years ago.
Yes, I saw this article on the web, but it is way more complicated than I want to deal with. However, I will accept the answer, I just wish it had been more helpful.

Thank You, Glen
Thanks for the accept... Please dont forget to leave a positive feedbac too...
You can contact me through just answer in the future too...

Thanks again...
Customer: replied 6 years ago.
I have pushed the accept answer button, more than once. I hope I'm not to be charged more than the one time. Please take care of this. Thank you.