Microsoft Word’s mail merge is an excellent productivity tool. Knowing how to create personalized subject lines and attachments that Word’s mail merge basic feature doesn’t support can be a life saver when you have to write emails in bulk.
In today’s article, you’ll learn how to use Word’s 2010 Mail Merge Wizard, write personalized email subjects, and setup different attachments for each of your email recipient.
Image by M!R
Creating a Distribution List
Word’s Mail Merge saves us from the tedious task of entering each recipient’s email address manually by allowing us to import email addresses from Outlook contacts, Excel or Access data sources, or Word data files.
Outlook’s contact is the best option among the three, and if you have not used it, now will be a good time to update your Outlook address book, and we’ll show you how to do so. You can skip the next section and start writing your mail merge, if you already know how to setup Outlook contact, otherwise the next two sections will give you some basics on how to setup your Outlook contact by importing your web based contact list.
Setup Your Mail Profile
Setting up Outlook contact begins with creating a mail profile that stores your account’s email address, password, server information and links to other data such as email messages and addresses.
You can create some profiles, each tailored to specific email account.
A proper profile name lets you identify the email account that you associate with your mail profile.
You have the option to configure your mail profile using the email address that you received from your ISP, or your own email account by selecting the third option.
Select “Internet E-mail” to use an email provider that gives a POP service – for example, GMail.
Each Internet email provider has different POP configuration, make sure to read their user manual to learn their POP setup.
Congratulations! If you see this screen, you have setup your mail profile successfully. Now, we are ready to setup our Outlook’s contact folder.
Populating Your Contact Folder
You can enter your distribution list manually into Outlook, or import other web based address books – such as GMail, Yahoo, or Hotmail address book. Most web based email providers allow us to export our their address book into an Outlook-compatible data source. For example, Gmail gives us the option to export our contacts into an Outlook-compatible CSV file.
Outlook import function supports a variety of file type: csv, vcard, RSS, iCalendar, and many more, making it a great tool to create your mail merge distribution list.
The CSV file falls under the “Other program or file” category in Outlook.
ACT file, DOS CSV, Lotus, Access 97-2003, PST files, are some of the program files that Outlook supports – for us, we chose Comma Separated Values (Windows) file type.
Now, locate the CSV file that we just exported from Gmail address book.
Out of all these folders, the contact folder is the best option for our mail merge purpose.
Outlook needs a few minutes to import your contact depending on the number of email addresses that you are importing.
We should be able to use this contact folder, once Outlook has finished importing all your contacts, for the mail merge.
Start with a blank document and open the “Mailings” ribbon to begin our mail merge.
The wizard is the best way for beginners to get started on their first mail merge exercise.
Selecting Message Recipients
The wizard will ask us to choose the document type for our mail merge, E-mail messages is the appropriate document type for today’s mail merge exercise.
We can start writing our email message from a blank document, a template, or an existing document.
Choose our Outlook contact folder as our mail merge distribution list in step 3.
We have the option to use any of the mail profile that we setup in our system.
Your contact count should be more than zero if Outlook imported your Gmail address successfully.
Choose the people that you want to include in your email distribution by ticking the appropriate check boxes.
Composing the Email Message
Start writing your email message and insert merge fields where you want to place personalized messages – such as title or last name in the appropriate place on your document.
Each merge field will be enclosed inside a double chevron; they will be substituted with your contact card information when you complete the mail merge wizard.
Preview your email message to see how Word processes the merge fields by clicking on the “Next: Preview your e-mail messages” link.
If you are happy with the preview, click the “Next:complete the merge” link, and Word will send the merged email to all your recipients with a common subject line.
Personalizing Your Subject Line
The wizard breaks the mail merge process into these steps: choosing the right document type and template, creating a distribution list, evaluating the mail merge preview, and sending out emails to all your recipients.
At this point, you may notice two common email writing activities that the wizard does not support, writing personalized subject lines, and setting up different attachments. We have to use macro to do them in mail merge, preferably before we complete the wizard.
With your letter open, press “Alt + F11″ and double click “ThisDocument” in your working Word window, to open the Macro editor.
Paste this macro code, written by an expert macro coder hutchinsfairy, into the blank pane and save it.
Dim WithEvents wdapp As Application
Dim EMAIL_SUBJECT As String
Dim FIRST_RECORD As Boolean
Private Sub Document_Open()
Set wdapp = Application
Private Sub Document_Close()
Set wdapp = Nothing
Private Sub wdapp_MailMergeBeforeRecordMerge(ByVal Doc As Document, Cancel As Boolean)
Dim i As Integer
If FIRST_RECORD = True Then
EMAIL_SUBJECT = .MailSubject
FIRST_RECORD = False
Else .MailSubject = EMAIL_SUBJECT
i = .DataSource.DataFields.Count
Do While i > 0
.MailSubject = Replace(.MailSubject, "<" & .DataSource.DataFields(i).Name & ">", .DataSource.DataFields(i).Value, , , vbTextCompare)
i = i - 1
Private Sub wdapp_MailMergeBeforeMerge(ByVal Doc As Document, ByVal StartRecord As Long, ByVal EndRecord As Long, Cancel As Boolean)
FIRST_RECORD = True
Private Sub wdapp_MailMergeAfterMerge(ByVal Doc As Document, ByVal DocResult As Document)
ActiveDocument.MailMerge.MailSubject = EMAIL_SUBJECT
Go back to your document and click on the “Next: complete the merge” link to send out your email.
Click on the “Electronic Mail…” link to send out your message.
Place the appropriate merge fields, surrounded with a chevron, into the subject line.
The macro will parse the merge field and replace it with the recipient’s last name when Word email the document.
Attaching Different Items to Your E-Mail
Up to this point, we have learned how to use the mail merge wizard and how to personalize the subject fields – and to complete today’s tutorial, we’ll show you a third party add-in that enable us to attach different file for each email.
Download the add-in, unzip it, and you’ll find that the add-in comes as Word Document templates. Use “CreateEMailData Word 2007 Ver02”, if you are using word 2007 or 2010, and “CreateEMailData Word 2003 Ver02”, if you are using Word 2003.
Copy the appropriate document template into your “%appdata%\Microsoft\Word\STARTUP” folder where “%appdata%” is your Microsoft startup folder-in our case it is “C:\Users\zainul\AppData\Roaming”.
Restart your Word, after you copy the file into the Microsoft startup folder, and you should see two new add-ins: Create Data File and Merge to Email, under the “Mailing” ribbon menu.
Prepare a data file with a two-column table – the recipient email address in the left column, and the full path to your attachment file in the right column, then save it under the same folder as your email merge document as “MergeAttachmentsData”. We need to stress that you must save the file as “MergeAttachmentsData”, otherwise the add-in can’t find the file to look up for attachments.
Go back to your mail merge document and split documents into individual files.
A new word document window should appear, and click the “Merge to Email” add-in button. Simply click the ‘Ok’ button on the yellow dialog, since we already prepared the data file.
Put a proper subject for your email, click OK, and Outlook will send your email with the attachment that you specify in the data file.
Word, with its many useful features, is truly a great productivity tool. We look forward to write more Word articles for our readers. In the meanwhile, check out the other Words articles on our site.
We hope that you have learned how to use Word mail merge from today’s article. Feel free to discuss other mail merge tips with the other fellow readers in the comments section.
Zainul spends his time trying to make technology more productive, whether it’s Microsoft Office applications, or learning to use web applications to save time.
- Published 01/25/11