Microsoft KB Archive/318118

= How to use the Mail Merge feature in Word to create and to print form letters that use the data from an Excel worksheet =

Article ID: 318118

Article Last Modified on 12/12/2006

-

APPLIES TO


 * Microsoft Office Excel 2007
 * Microsoft Office Excel 2003
 * Microsoft Excel 2002 Standard Edition
 * Microsoft Office Word 2007
 * Microsoft Office Word 2003
 * Microsoft Word 2002 Standard Edition

-



This article was previously published under Q318118





SUMMARY
This article explains how to use the Mail Merge feature in Microsoft Word to create and to print form letters by using data from a Microsoft Excel worksheet.

When you use the Word Mail Merge feature, Word merges a main document with a recipient list to generate a set of output documents:
 * The main document contains the basic text that is the same in all of the output documents. It may contain a letterhead, text, and instructions in merge fields for inserting text (such as recipient names and addresses) that vary from one output document to another.
 * The recipient list is a database that contains the data that is to be merged into the output documents. For example, the recipient list is a Microsoft Access database file or an Excel worksheet.

This database is typically a list of names, addresses, phone numbers, and other categories of personal information.
 * The output documents are the result of the mail merge. The text in an output document can be the same in all output documents, but you can apply formatting to specific documents.

Step 1: Set Up the Excel Data File
Before you proceed with the Mail Merge Wizard, make sure that your Excel worksheet is well structured for this purpose. Note the following requirements for the data table:
 * The first row should contain field names for each column -- for example, Title, Salutation, First Name, Middle Name, Last Name, Address1, and Address2.
 * Each field name should be unique.
 * Each row should provide information about a particular item. For example, in a mailing list, each row might include information about a particular recipient.
 * The table should contain no blank rows.

Create your Excel data file, and then arrange it by using the fields that you want to use for your letter, as shown in the following sample data file.

After you create your Excel data file, save it, and then close the data file.

For more information about how to create a mail-merge address list, click the following article number to view the article in the Microsoft Knowledge Base:

294688 How to design and set up a mail merge address list in Word 2002 and in later versions of Word

Step 2: Set Up the Main Document
 In Microsoft Office Word 2003 and in earlier versions of Word, point to Letters and Mailings on the Tools menu, and then click Mail Merge Wizard.

In Microsoft Office Word 2007, click Start Mail Merge in the Start Mail Merge group on the Mailings tab, and then click Step by Step by Mail Merge Wizard. Under Select document type, click Letters.

The active document becomes the main document. The main document contains the text and graphics that are the same for each version of the merged document. For example, the return address and the salutation in a form letter are the same for each version. Click Next: Starting document. Use one of the following methods:  Start with the document that is currently shown in the document window. To do this, click Use the current document.

You can then either type the letter in the document window or wait until the wizard prompts you to do so in a later step. Start with a template. To do this, follow these steps:  Click Start from a template.</li> Click Select template.</li> On the Mail Merge tab, select the template that you want in the Select Template dialog box, and then click OK.</li></ol> </li> Start with an existing document. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> Click Start from existing document.</li> In the Start from existing box, select the document that you want, and then click Open.</li> If you do not see the document, click More files, and then click Open. In the Open dialog box, locate the document that you want, and then click Open.</li></ol> </li></ul> </li> Click Next: Select recipients.</li></ol>

Step 3: Specify the Excel Data Source

 * 1) Under Select recipients, click Use an existing list.
 * 2) Click Browse.
 * 3) In the Select Data Source dialog box, locate and then click the Excel worksheet that you want to use.

By default, Word opens the &quot;My Data Sources&quot; folder.
 * 1) Click Open.
 * 2) If your Excel worksheet contains information about multiple tabs, select the tab that contains the information that you want, and then click OK.
 * 3) All entries in the data source appear in the Mail Merge Recipients dialog box. Here, you can refine the list of recipients to include in the merge.

Step 4: Select the Recipients
<ol> In the Mail Merge Recipients dialog box, select the recipients that you want to include. To do this, use one of the following methods: <ul> Use the check boxes to designate recipients.

This method is most useful if the list is short. Click to select the check boxes next to the recipients that you want to include, and then click to clear the check boxes next to the recipients that you want to exclude.

Note If you know that you want to include most of the list in your merge, click Select All, and then click to clear particular records. Similarly, if you want to include only a few records in the list, click Clear All, and then select the records that you want.</li> Sort items in the list.

This method is useful if you want to see items in alphabetical or numeric order. Click the column heading of the element by which you want to sort. For example, if you want to display the list alphabetically by last name, click the Last Name column heading.</li> Filter items in the list.

This method is useful if the list contains records that you know you do not want to see or include in the merge. After you have filtered the list, you can use the check boxes to include and exclude records, as described earlier. To filter the list, follow these steps: <ol style="list-style-type: lower-alpha;"> Click the arrow next to the column heading of the element that you want to filter by.</li> Click any of the following: <ul> (Blanks): This option displays all the records in which the corresponding field is blank.</li> (Nonblanks): This option displays all the records in which the corresponding field contains information.</li> <li>If the data source contains records that share the same information, and if there are 10 or fewer unique values in the column, you can filter by specific information. For example, if there are multiple addresses that list Australia as the country, you can filter by Australia.</li></ul> </li></ol> </li> <li>The Mail Merge Recipients dialog box displays only the designated records. To display all the records again, click (All).</li></ul>

Notes <ul> <li>For advanced sorting and filtering, click the arrow next to any column name, and then click (Advanced). Use the Filter Records and Sort Records tabs to set up the sorting or filtering query that you want.</li> <li>If you have installed address validation software, click Validate in the Mail Merge Recipients dialog box to validate your recipients' addresses.</li></ul> </li> <li>Click OK to return to the Mail Merge Wizard.

Word uses the recipients that you designated for the merge.</li> <li>Click Next: Write your letter.</li></ol>

Step 5: Complete the Letter and Add Merge Fields
If you have not already done this, type the text that you want to appear in every form letter in the main document.

Insert Merge Fields
Insert merge fields where you want to merge names, addresses, and other information from the data source. To insert merge fields, follow these steps: <ol> <li>In the main document, click where you want to insert the field.</li> <li>Insert any of the following: <ul> <li>Address block with name, address, and other information: <ol style="list-style-type: lower-alpha;"> <li>Click Address block.</li> <li>In the Insert Address Block dialog box, select the address elements that you want to include and the formats that you want, and then click OK. For help on an option, click the question mark, and then click the option.

</li> <li>For help on an option, click the question mark, and then click the option. If the Match Fields dialog box appears, Word may be unable to find some of the information it needs for the address block. Click the arrow next to (not available), and then select the field from your data source that corresponds to the field required for the mail merge.</li></ol> </li> <li>Greeting line: <ol style="list-style-type: lower-alpha;"> <li>Click Greeting line.</li> <li>Select the greeting line format that includes the salutation, name format, and following punctuation.</li> <li>Select the text that you want to appear in the cases in which Word cannot interpret the recipient's name. For example, Word cannot interpret the name when the data source contains no first or last name for a recipient, but only a company name.</li> <li>Click OK.</li> <li>If the Match Fields dialog box appears, Word may be unable to find some of the information it needs for the greeting line. Click the arrow next to (not available), and then select the field from your data source that corresponds to the field required for the mail merge.</li></ol> </li> <li>Other fields of information: <ol style="list-style-type: lower-alpha;"> <li>Click More items.</li> <li>Use one of the following methods: <ul> <li>Click Address Fields to select from address fields that will automatically map to corresponding fields in your data source, even if the data source's fields do not have the same name as your fields.</li> <li>Click Database Fields to select from fields that always take data directly from a column in a database.</li></ul> </li> <li>In the Fields box, click the field that you want.</li> <li>Click Insert, and then click Close.</li> <li>If the Match Fields dialog box appears, Word may not be able to find some of the information it needs to insert the field. Click the arrow next to (not available), and then select the field from your data source that corresponds to the field required for the mail merge.

Note If you insert a field from the Database Fields list, and if you later switch to a data source that does not have a column with the same name, Word cannot insert that field information into the merged document.</li></ol> </li> <li>Electronic postage:

To add electronic postage, you must first install an electronic postage program, such as one that you can purchase from a third-party provider on the Web. To use electronic postage, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>Click Electronic postage.

If you do not have an electronic postage program installed, Word prompts you to install one, and offers to connect to the following Microsoft Office Web site:

Print Online Postage

http://office.microsoft.com/services/service.aspx?sid=2.4

</li> <li>Insert the postage according to the program's instructions.</li></ol> </li> <li>To add electronic postage, you must first install an electronic postage program, such as one that you can purchase from a third-party provider on the Web. To use electronic postage, follow these steps:Postal bar code: You must select a letter or envelope type that supports the POSTNET bar code. To use the Postal bar code, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>Click Postal Bar Code.</li> <li>In the Insert Postal Bar Code dialog box, select the appropriate address fields.

Note The Postal Bar Code option appears only if you are using the U.S. language version of Word.</li> <li>Repeat steps a and b for all the fields that you want to insert. NOTES: <ul> <li>You cannot type merge field characters (&quot; &quot;) or insert them by using the Symbol command on the Insert menu.</li> <li>If the merge fields appear inside braces, such as { MERGEFIELD City }, Word is displaying field codes instead of field results. This does not affect the merge, but if you want to display the results instead, right-click the field code, and then click Toggle Field Codes on the shortcut menu.</li></ul> </li></ol>

For example, by using the sample database shown earlier, your letter might contain the AddressBlock and GreetingLine fields, and therefore your first page appears similar to the following:

'''February 26, 2002

Type your letter here.

Sincerely,

Type your name here

'''

</li></ul>

Note You can also use the Mail Merge toolbar to insert merge fields, work with your mail-merge main document, or run a mail merge. To display the Mail Merge toolbar, point to Letters and Mailings on the Tools menu, and then click Show Mail Merge Toolbar.

The Mail Merge toolbar provides additional commands that are not included in the Mail Merge Wizard task panes. For example, you can use the Insert Word Field menu on the Mail Merge toolbar to insert Word fields for controlling the merge process. For example, you can insert an IF field that inserts text only if a particular merge field has a specified value.

Alternatively, you can click Check For Errors to make Word run the mail merge and report any errors that are contained in the main document.</li></ol>

Change the Format of the Merged Data
To format merged data, you must format the merge fields in the main document. Do not format the data in the data source, because its formatting is not retained when you merge the data into the document. To change the format of the merged data, follow these steps:
 * 1) In the main document, select the field that contains the information that you want to format, including the enclosing merge field characters (<< >>).
 * 2) In Word 2003 and in earlier versions of Word, click Font on the Format menu, and then select the options that you want.

In Word 2007, click the option that you want in the Theme Fonts box in the Font group on the Home tab.

Format by Using Field Codes
To control other aspects of formatting, press ALT+F9 to display field codes, and then add switches to the merge fields. When you work with fields, a switch is a special instruction that causes a specific action to occur. Generally, a switch is added to a field to modify a result.

Examples of how to use switches are as follows:
 * To display the number 34987.89 as $34,987.89, add the Numeric Picture switch (\#).
 * To print client names in uppercase letters, add the Format switch (\*).
 * To make sure that the merged information has the same font and point size that you apply to the merge field, add the Charformat switch (\*).

Step 6: Save the Document
After you have completed the main document and inserted all the merge fields, make sure that you save the document before proceeding. To do this, follow these steps:
 * 1) In Word 2003 and in earlier versions of Word, click Save As on the File menu.

In Word 2007, click the Microsoft Office Button, and then click Save As.
 * 1) Name the document, and then click Save.
 * 2) Click Next: Preview your letters.

Step 7: Preview the Letters and Fine-Tune the Recipient List
When the wizard displays the &quot;Step 5 Mail Merge&quot; task pane, the wizard replaces each of the merge fields in the main document that has the actual text from the first entry of the recipient list.Therefore, you can see how your first output document will look.

For example, if you were to continue to use the sample database shown earlier, the first page should resemble the following page after you click Next: Preview your letters:

'''February 26, 2002

Andrew Fuller

908 W. Capital Way

Tacoma 98401

Dear Andrew Fuller,

Type your letter here.

Sincerely,

Type your name here'''

To preview additional entries, use one of the following methods:
 * To preview the items in order, click the left or right arrow buttons.
 * To locate and preview a specific item, click Find a recipient, and then enter the search criteria in the Find Entry dialog box.

Fine-tune the recipient list if you want. To do this, use one of the following methods:
 * To exclude a particular recipient from the merge operation, click Exclude this recipient.
 * To change the list of recipients, click Edit recipient list, and then make your changes in the Mail Merge Recipients dialog box.

Step 8: Complete the Merge
To complete the merge, use any of the following methods.

Personalize Individual Letters
To personalize individual items, you actually complete the merge, and then edit the information that you want in the resulting merged document. To do this, follow these steps:
 * 1) Click Edit individual letters.
 * 2) In the Merge to New Document dialog box, select the records that you want to merge.
 * 3) Click OK.

Word creates and opens a new merged document. Your main document also remains open, and you can switch back to it if you want to change all the documents.
 * 1) Scroll to the information that you want to edit, and then make your changes.
 * 2) Print or save the document just as you would any regular document.

Print the Letters
To print the letters, use one of the following methods:
 * If you personalized the items and if the merged document is active, follow these steps:
 * In Word 2003 and in earlier versions of Word, click Print on the File menu.

In Word 2007, click the Microsoft Office Button, and then click Print.
 * Select the options that you want.
 * If you want to print directly from the Mail Merge Wizard, follow these steps:
 * In Step 6 of the Mail Merge Wizard (Complete the merge), click Print.
 * In the Merge to Printer dialog box, use one of the following methods, and then click OK:
 * To print all the documents, click All.
 * To print the document that you see in the document window, click Current record.
 * To print a range of documents, click From, and then type the record numbers in the From and To boxes.
 * In the Print dialog box, select the options that you want.

Save the Merged Letters for Later Use
If you want to edit merged letters or to save them for later use, you can collect them into a single document. To do this, follow these steps:
 * 1) Click Edit individual letters.
 * 2) In the Merge to a New Document dialog box, use one of the following methods, and then click OK:
 * 3) * To merge all the documents, click All.
 * 4) * To merge only the document that you see in the document window, click Current record.
 * 5) * To merge a range of documents, click From, and then type the record numbers in the From and To boxes.
 * 6) Word opens a single new document that contains all the individual letters. You can then save the document for later use, just as you would any regular document.

<div class="references_section">