WD2000: How to Use AutoText Entries to Merge a Single Data Source to Multiple Letters (211786)



The information in this article applies to:

  • Microsoft Word 2000

This article was previously published under Q211786

SUMMARY

When you use the Mail Merge feature of Microsoft Word, you can use only one main document with one data source. However, with the use of IF and AutoText fields, or IF and IncludeText fields, you can simulate merging one data source into several letters.

Using AutoText fields stores your information in AutoText entries; using IncludeText fields stores your information in separate letters. Either method will produce the same results.

This article describes how you can use the AutoText fields to produce several letters with one data source. For additional information about how to use the IncludeText method instead, click the following article number to view the article in the Microsoft Knowledge Base:

299837 How to Merge a Single Data Source to Multiple Letters with IncludeText

MORE INFORMATION

To merge a single data source to multiple letters using AutoText fields, use the following steps:

Step 1 - Set Up the Mail Merge Main Document

To create a mail merge to produce several different letters to different people based on a particular set criteria, you first must create and save separate documents as either AutoText entries or as documents that contain the merge fields you want to use.

In a new document, use AutoText entries to set up the file as a mail merge main document.
  1. On the Tools menu, click Mail Merge.
  2. In the Main document section of the Mail Merge Helper dialog box, click Create, and then click Form Letters. In the next dialog box that appears, click Active Window.
  3. In the Data source section, click Get Data, and then click Open Data Source. In the Open Data Source dialog box, find your data source, and then click Open.

    The Header Record Delimiters dialog box appears.
  4. In the Header Record Delimiters dialog box, select a Field delimiter and a Record delimiter.
  5. In the message box that appears, click Edit Main Document.
  6. Create the first letter, and then enter the appropriate merge fields.
  7. On the Edit menu, click Select All.
  8. On the Insert menu, point to AutoText, and then click New. Type a name, for example, "Letter1," and then click OK.
  9. Modify this letter to reflect the format or style you want for your second merge document. Enter merge fields as appropriate.
  10. Repeat steps 7 through 9 for each type of letter you need. When you name the AutoText entry, use a different name, such as "Letter2," "Letter3," and so on.

Step 2 - Modify the Data Source

After you create all of the letters as AutoText, you need to modify your data source to include a field that will be helpful in identifying which letter you will create for a particular record.
  1. Using the mail merge main document you created in the "Setting Up the Mail Merge Main Document" section of this article, on the Edit menu, click Select All, and then press DELETE to create an empty document.
  2. On the File menu, click Save As, give it a different file name, and then click Save.
  3. On the Tools menu, click Mail Merge. Under Data Source, click Edit, and then click the name of the data file. The Data Form dialog box appears.
  4. Click View Source to open the data file.
  5. To create a new field, click the Manage Fields button on the Mail Merge toolbar.
  6. In the Field name box, type a field name (for example, type Code) click Add, and then click OK.
  7. For each record, enter a code in the Code field to identify which AutoText "letter" entry will be used for that particular record. For example, if you created three letters as AutoText entries, for each record in your Data source, enter a 1, 2, or 3 into the Code field. Code 1 represents the first AutoText entry, Letter1; code 2 represents the second AutoText entry, Letter2; code 3 represents the third AutoText entry, Letter3, and so on.

Step 3 - Modify the Main Document

You need to modify the blank main document to include IF fields that identify which AutoText letter will be merged for each particular record.
  1. At the top of the blank document, follow these steps to enter an IF field into the document:
    1. Press CTRL+F9 to insert field braces {} in the document.
    2. Type the following text so that the end result of the field resembles this example:
      {IF{MERGEFIELD Code}="1" "{autotext "Letter1"}"}
      							
      Note Everywhere you see a left field brace ({), you need to insert it by pressing CTRL+F9.
    3. For each AutoText "letter" entry you have, create the same type of field. For example, if you create three letters, you have the following three IF fields:
          {IF{MERGEFIELD Code}="1" "{AutoText "Letter1"}"}
          {IF{MERGEFIELD Code}="2" "{AutoText "Letter2"}"}
          {IF{MERGEFIELD Code}="3" "{AutoText "Letter3"}"}
      							
      Note The code number changes along with the AutoText letter number.
  2. Save the main document.

Step 4 - Merge the Documents

When you perform the mail merge, Word produces the AutoText letter designated for the code the data file has for a particular record. For example, if Record 1 has the value 1 in the Code field, the fields from this record will be displayed in Letter1. If Record 2 has a code of 3, the merge produces Letter3.

REFERENCES

For more information about mail merge, click Microsoft Word Help on the Help menu, type using mail merge in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.


For additional information about using the IncludeText method, click the article number below to view the article in the Microsoft Knowledge Base:

299837 How to Merge a Single Data Source to Multiple Letters with IncludeText


Modification Type:MinorLast Reviewed:4/21/2003
Keywords:kbfield kbhowto kbmerge KB211786