University of Essex Homepage Computing Service - Go to Home Page
. . . .
CONTENTS A-Z   |   SEARCH   |   CHANGE YOUR PASSWORD  |  ANNOUNCEMENTS  |  STATUS MESSAGES
. . . .

mm-title2.gif (12341 bytes)

CONTENTS for the beginner user ....

ADDITIONAL CONTENTS for the more advanced user ...


INTRODUCTION

Creating any type of mail merge document involves merging a main document with a data source.  The main document will contain the text and other items that remain constant within a letter, whilst the data source will contain the variable information, for example, the addressee's name and address, salutation, etc.  Merge fields inserted within the main document will instruct WORD as to where the variable data should appear in the final printout of the letter.

mm-1.gif (27304 bytes)

THE MAIN DOCUMENT

The main document will contain all the information that you require to be constant in each letter.  EITHER ...

  1. Open an existing letter created by WORD or some other word processing package, OR ...

  2. Open a new document based on a letter template (see the FILE-New command), OR ...

  3. Use the active document window if you have just created or edited a letter; make sure you are not displaying the data source in the active window!

  4. From the TOOLS menu choose the command Mail Merge.

  5. Under Main Document choose the Create button.

  6. Choose the option Form Letters and then make a further choice:

  7. EITHER choose the option Active Window if you are already working on the standard letter;

  8. OR choose the option New Main Document if the standard letter needs to be created in another window.


THE DATA SOURCE

PLANNING THE DATA SOURCE

The data source will contain the variable information (for example, names and addresses) which is to be merged with the main document to produce the form letter. You can EITHER ...

In a data source, each record must have the same number of data fields even if some records contain more information than others. It therefore helps to organise your data in a table, where each column represents a data field or data category.  When your data source is complete, you may find that certain fields are empty but you can decide at the time of merging whether or not blank fields will be printed. 

Plan carefully how the addresses are to be typed within the data source, particularly as the file may also be used to print mailing labels and envelopes. In some ways, it is easier to type the title, first name and last name in the one data field, or postal codes after the town and/or county, but this practice makes potential sorting of fields difficult. Therefore the various elements of an address are best accommodated in separate fields.

CREATING THE DATA SOURCE

The method below organises the variable information in a table; the columns represent data fields and rows of information represent data records.

NOTE: The first row of information in the table usually identifies the data fields and is therefore known as a header row or header source.

  1. Choose the TOOLS-Mail Merge command and in the Mail Merge Helper dialogue box under Data Source, click the Get Data button.

  2. Choose the Create Data Source option.

  3. In the Field Names In Header Row box, WORD lists field names for the categories of data commonly used in a data file of this kind.

  4. To delete a category from the data source, select a suggested field name and click the Remove Field Name button.

  5. To add a category to the data source, type the new field name in the Field Name box and click the Add Field Name button. A field name can contain up to 40 characters (no spaces), and although letters, numbers and underscore characters can be used, make sure that the field name starts with a letter.

  6. To change the order of field names, select a field name in the Field Names In Header Row box and click the up or down arrow on the right of the list until the field name is in the required location.

  7. Choose OK, whereupon WORD displays the Save Data Source dialogue box. Under File Name, type a name for the document and again choose OK.

  8. WORD displays a message asking you whether you wish to Edit Data Source or Edit Main Document.

REMEMBER: You can add information to the data source file at any time before merging it with the main document.

OPENING AN EXISTING DATA SOURCE

  1. Choose the TOOLS-Mail Merge command and in the Mail Merge Helper dialogue box under Data Source, click the Get Data button.

  2. From the Open Data Source dialogue box, select the file you wish to open as the data source for the active main document.

  3. You may have to change the current drive and the directory in order to locate the file you require, particularly if your data source has been created by another application.

  4. If your data source is a Microsoft Excel worksheet, you can insert the whole worksheet or a range of cells; if you open a Microsoft Access database, you can insert records from a table or a selection of records defined by a query.

  5. If you have not inserted merge fields into the main document, WORD will prompt you to do so after opening the data source. Choose the Edit Main Document button to return to the main document.

  6. If you use an existing data source or set up your own data source table, you must ensure the following:

  7. Make sure the header row is the first row of cells in the data source table and that there are no spaces, blank lines or even text before the header row.

  8. Make sure that in each data record, the number of fields matches the number of field names in the header row. If a record does not have information for a certain field, then leave the cell (field) blank.

  9. The order in which the field names appear in the header row is not important for it is where the merge field is inserted into the main document that really matters. However, make sure that in each data record, the correct information appears beneath the field name in the header row.

Suppose my data does not appear in a table?

This might happen if ...

  1. You have specified more than 31 field names in the Create Data Source dialogue box, in which case, the header row and data records will be separated one from the other by a paragraph mark (the data record delimiter), and the fields within the data records separated by either a tab character or a comma* (data field delimiter). NOTE - It is better to use the tab character as a field item may already contain commas!

  2. Some data sources converted from other applications may also have this format, even if they contain fewer than 31 field names. If a data source contains delimiters that WORD cannot recognise, then WORD will ask you to select appropriate delimiters when you first use the data source.

The following rules must apply to data sources set up as regular text:

USING A SEPARATE HEADER SOURCE

You may wish to use a separate header record for the following reasons:

How do I specify a separate header source?

  1. With the main document in the active window, choose the TOOLS-Mail Merge command.

  2. Under Data Source, choose the Get Data button and then choose Header Options.

  3. EITHER create a new header source, by choosing the Create button; type or select a name for each field and remember to use the Move Up/Move Down buttons to change the order of the field names if required;

  4. OR open an existing header source by choosing the Open button and typing/selecting the filename of the existing header source.

  5. When specifying a header source, remember the following:

ADDING, EDITING AND DELETING INFORMATION IN THE DATA SOURCE

The data source can be viewed in one of two modes ...

The instructions below concentrate on making changes to the data source via the Data Form dialogue box, although you could just as easily make changes to the data source table which behaves like any other table in WORD (these instructions within square brackets).

  1. To display the Data Form dialogue box choose the TOOLS-Mail Merge command, choose Edit under Data Source and select the required data source from the list.

  2. In the Data Form dialogue box type or edit the information for each data field in the correct boxes; press TAB to move to the next data entry box(es) or SHIFT + TAB to move to the previous data entry box(es).  [Or choose the View Source button in the Data Form box which displays the data in the form of a table; type or edit the information within the appropriate cell of the table and press the TAB or SHIFT + TAB to move to the next or previous cells of the table.]

  3. In the Data Form dialogue box choose the Add New button to start a new record. [Or with the insertion point in the very last cell of the data source table, press the TAB key to create a new row/record.]

  4. In the Data Form dialogue box choose the Delete button to remove the current record. [Or delete the appropriate row (record) of the table by choosing the TABLE-Delete Rows command.]

  5. In the Data Form dialogue box, choose OK when you have finished adding or editing information.

  6. When you need to save the changes, first view the entire data source by clicking the View Source button in the Data Form dialogue box. To return to the main document, click the Mail Merge Main Document button on the Database Toolbar.

EXPLORING THE DATABASE TOOLBAR

mm-2.gif (4849 bytes)

The Database toolbar is displayed when the data table is on screen - from the Data Form dialogue box, click the View Source button.

ADDING, DELETING AND RENAMING FIELDS IN THE DATA SOURCE

Suppose you wish to add a further category of information to the data source, for example fax numbers alongside addresses and telephone numbers.

  1. Choose the TOOLS-Mail Merge command and in the Mail Merge Helper dialogue box, under Data Source, click the Edit button.

  2. Select the data source required. WORD then displays the Data Form dialogue box, starting with the information for the first data record.

  3. Click the View Source button to display your data table and to also display the Database Toolbar.

  4. To add data fields, click the Manage Fields button on the Database Toolbar, type a new field name and click the Add button; repeat this procedure for every new field that you need to add. This method adds new data fields to the end of existing field names in the Data Form dialogue box or to the right of the data source table. [Or in the data source table you can select the column to the right of where you wish the new field to be inserted, choose the TABLE-Insert Columns command and in the first cell, type the new field name. This method inserts a new field in the desired position, both in the Data Form dialogue box and in the data source table.]

  5. To delete a field name from the data source, highlight it in the Manage Fields list and click the Remove button - data associated with this field name will be removed from the data source. [Or in the data source table select the column (data field) to be deleted and choose the TABLE-Delete Columns command.]

  6. To rename a field name from the data source, highlight it in the Manage Fields list and click the Rename button. [Or in the data source table amend the field name as you would amend any tabled text.]

  7. Choose OK when you have finished adding/editing fields.

NOTE: When the Mail Merge Helper dialogue box is used to either save or open data sources, WORD stores information concerning the data source alongside the main document. Therefore if you change the location of the data source, WORD will ask you confirm the new location of the data source when you next open the main document.

SEARCHING FOR INFORMATION WITHIN THE DATA SOURCE

  1. To display the Data Form dialogue box choose the TOOLS-Mail Merge command, choose Edit under Data Source and select the required data source from the list.

  2. In the Data Form dialogue box choose the Find button.

  3. In the Find What box type the information being searched for.

  4. In the In Field box select the data field containing the type of information being searched.

  5. Choose the Find First and subsequently the Find Next buttons. You may have to drag the Find In Field box out of the way if it obscures the data behind it.

  6. Choose the Close button when you have completed your search.

NOTE: You can also search for records by choosing the Find Record button on the Database toolbar.

COMPLETING THE MAIN DOCUMENT WITH MERGE FIELDS

  1. At the locations within the main document where the information is to be inserted from the data source, click the Insert Merge Field button on the Mail Merge toolbar and choose the appropriate merge field.

  2. As long as you are not displaying field codes*, then merge field data is displayed between two chevron symbols « like this » which WORD alone inserts (you cannot simply type these merge field chevrons and neither can you insert them by using the INSERT-Symbol command). You can format the merge field like other text, even copy and move it, but you cannot make changes to the field name itself.

  3. Be sure to insert any spaces or punctuation that you require after a merge field or between two merge fields.

  4. If there are no further edits to be made to the main document, choose the Save command from the FILE menu.

NOTE* To display or hide field codes, press ALT + F9, whereupon each merge field is displayed as a MERGEFIELD field within two curly brackets { like this }. You can now edit any field name, but take care that the field name should still match the corresponding field name in the header row of your data source!

 mm-3.gif (2123 bytes)


MERGING DATA WITH THE MAIN DOCUMENT

You are ready to merge the data source and the main document if you have completed the following:

EXPLORING THE MAIL MERGE TOOLBAR

mm-4.gif (10772 bytes)

The Mail Merge toolbar is displayed when a main document is opened. Buttons on the toolbar control the way in which the main document is displayed and also the way in which information from the data source is merged within the form letter.

To display the Mail Merge dialogue box - click the Mail Merge button to display the Mail Merge dialogue box wherein you can choose further options before merging.

Previewing merged data - With the main document in the active window, click the View Merged Data button on the Mail Merge toolbar.   Information from the first data record is displayed in the main document in place of the merge fields. In order to view information from other data records, click one of the arrow buttons on the Mail Merge toolbar or type the number of the record in the box. You can print the document with the previewed information by choosing the FILE-Print command.

Previewing specific data records - Data records with specific information can be previewed by clicking the Find Record button. For example, you may wish to merge data from records of addressees living in one area of the country.

Merging to a new document - by clicking this button, all merged form letters are placed in one single document, each letter separated by a new page section break. Individual letters can be personalised by typing additional comments where appropriate.

To print the letters choose the FILE-Print command. To print specific letters, the section numbers (equivalent to the required letters) must be typed in the Pages box - for example, to print the fifth letter, you must print s5.

Checking for errors - by clicking the Check for errors button, both the data source and the main document can be checked before a merge is attempted. And you can indicate to WORD as to how you wish the result to be reported. For example, suppose one of the field names in the main document does not match the field names in the data source? WORD informs you of this and you can then choose either to remove a mismatched field, or to replace it with the appropriate field from the data source.

Back to the top


For advanced users ....   

USING WORD FIELDS IN THE MAIN DOCUMENT

Word fields are codes that instruct WORD to insert additional information within the main document, to further personalise form letters, contracts and other merged documents.

INSERTING 'IF' FIELDS

When you insert an IF ... THEN ... ELSE ... field into a document, WORD will ask you to specify a condition which the data record must satisfy before printing. (You can specify alternative text to be printed if the condition is not met.)

It is also possible to specify multiple conditions by nesting IF fields. You can require that all conditions of the IF fields or any one condition be met before the specified text is printed.

  1. In the main document position the insertion point at the location where the IF text will be printed if the specified condition is met.

  2. Then click the Insert Word Field button on the Mail Merge toolbar and choose the option If ... Then ... Else.

  3. In the Insert Word Field dialogue box under Field name, select the field which is to be involved in the IF condition.

  4. Under Comparison, choose an appropriate comparison phrase, for example 'Equal To'.

  5. Under Compare To type in the text or numbers with which the field name is to be compared.

  6. Under Insert This Text type the text which will be printed if the condition is met during the merging procedure.

  7. Then under Otherwise Insert This Text type the alternative text to be printed if the condition is not met during merging. If no alternative text is required, leave this box blank.

  8. Choose OK.

INSERTING SET (SET BOOKMARK), ASK AND FILLIN FIELDS

NOTE: You cannot insert any of the above as a header, footer, footnote or annotation.

A SET field assigns a value (either text or a number) to a bookmark and therefore you must first insert a bookmark field into the main document text - you can insert a bookmark field into a document as many times as required.

FILLIN and ASK fields display a prompt as each data record is merged, allowing you to type different information in each of the resulting merged documents. Note the difference however : information typed in response to a FILLIN prompt replaces the FILLIN field in the main document. However information you type in response to an ASK field is assigned to a bookmark. Therefore you must insert a bookmark field into the main document text before your ASK text is printed in the merged form letters - you can insert the bookmark many times.

Let's suppose we are composing the main document below to a number of students who have written in for information about couses (the merge fields are between the chevron marks « like this »:

mm-5.bmp (725954 bytes)

To insert a SET BOOKMARK field

This will replace the word 'information' (line 1, para 2) with the words 'standard undergraduate package' in all the merged letters. 

  1. At the top of your main document click the Insert Word Field button on the Mail Merge toolbar and choose the option Set Bookmark.

  2. Type the name of your bookmark; let us suppose our bookmark is to be named 'info'.  

  3. Assign a value (either text or numbers) to the bookmark which will replace the word 'information' (line 1, para 2) in the merged form letters. Let us suppose our value for the bookmark is to be the text 'standard undergraduate package'.

  4. Click OK to set the bookmark.

  5. If you want to see the field code created as a result of actions 1-4, press ALT + F9 on the keyboard. 

  6. In the main document, highlight the word 'information' and choose the INSERT-Cross Reference command. Under Reference Type select Bookmark; under Insert Reference To, select Bookmark Text; under For Which Bookmark select the bookmark 'info'.   Click the Insert button.

  7. The words 'standard undergraduate package' now replace the word 'information' in line1 para 2, not only in the main document, but also in the resulting form letters. 

To insert a FILLIN field

This adds additional information to some or all of the merged (form) letters:

  1. Position the insertion point in the main document at the location of the fill-in text (at the end of the letter in this case); click the Insert Word Field button on the Mail Merge toolbar and choose the option Fill-in.

  2. Under Prompt type the text which will form the question/prompt during the merging procedure, for example ... 'When does the information expire?'

  3. Under Default Fill-in Text type the text which may or may not appear on your form letters, depending upon whether you choose to include the fill-in text or not. For example ... 'The information is current until the end of December 1999'.

  4. Click the Ask Once option if you want WORD to display the prompt only once during the merge, or leave it blank if you require the prompt as every data record is merged.

  5. Choose OK.

  6. When you merge the main document with the data source you will be prompted (the number of times depends on 4 above) as to whether you require the fill-in text to be printed. In the merged (form) letters, the fill-in text will be printed in the corresponding position of the FILLIN field in the main document.

To insert an ASK field

This has the same outcome as inserting the SET BOOKMARK field above, but allows you the opportunity to type in the text you require as each letter is merged. 

  1. At the top of your main document click the Insert Word Field button on the Mail Merge toolbar and choose the option Ask.

  2. Under Bookmark type or select the name of your bookmark; let us suppose our bookmark is named 'info'.

  3. Under Prompt type the text of the question/prompt which is to be displayed during the merging procedure. Let us suppose our prompt will be 'What does the information comprise?'

  4. Under Default Bookmark Text type the information that is to be the response to the ASK prompt. Let us suppose our response will be 'Undergraduate Prospectus'.

  5. Click the Ask Once option if you want WORD to display the prompt only once during the merge, or leave it blank if you require the prompt as every data record is merged. Click OK.

  6. The next stage is to bookmark the word 'information' in the main document (line 1, para 2).  Select the word and choose the INSERT-Bookmark command.  Type or select the name of the bookmark (in this case 'info') and click Add.

  7. The final stage is to make a cross-reference between the word 'information' (line 1, para 2) and the bookmark 'info'.   Select the word and choose the INSERT-Cross Reference command. Under Reference Type select Bookmark, under Insert Reference To select Bookmark Text, and under For Which Bookmark, select the bookmark 'info'.

  8. The words 'Undergraduate Prospectus' replace   'information' not only in the main document, but in as many of the merged letters as you chose in (5).

INSERTING THE RECORD NUMBER (MERGEREC) OR SEQUENCE NUMBER (MERGESEQ)

If you insert a MERGEREC field the record number of each merged data record is printed on the resulting form letter.  Therefore if you merge records 10-20, the number on the first letter is 10.  

A MERGESEQ field counts the number of data records that were successfully merged during the current merge job. When you begin merging the records, WORD sets the sequence number to 1 even though record 10 might be the first data record to be merged.


QUERY OPTIONS

SELECTING RECORDS FOR MERGING

WORD stores such record selection rules along with the main document, alongside other information pertaining to the data source, for example, name and location. If the records have also been sorted, then WORD also stores the sorting information.

The next time you open the main document, WORD locates and opens the data source, retrieves and sorts the data records according to the query options you have specified.

NOTE: If you have selected certain records as a result of a query option, each selected record assumes a record number in accordance with its position in the selected merge list - however the position of the same record in the original data source will remain unchanged. Therefore a record which assumes sixth position in the selected list may actually be record number 15 in the complete data source.

Specifying record selection rules

A record selection rule comprises three parts:

  1. A field name which must correspond to a data field in the data source.

  2. A comparison phrase such as 'Equal to' or 'Is not blank'.

  3. Text or numbers with which you require the data field to be compared.

For example, if you require records of people with last names beginning with the letters A to L, then having chosen the field name 'LastName' under Field, you must now type 'Less Than' under Comparison and 'M' under Compare To (ie Lastname Less Than M).

Multiple selection rules

Up to six selection rules may be specified in order to narrow down the range of data records being selected. However, you must specify AND or OR to connect each additional rule to the preceding rule. In sets of rules containing both AND and OR, rules connected by AND have precedence - this means that the AND rule(s) will be used to select/eliminate records before the OR rule(s) is taken into account

SORTING RECORDS

It is possible to sort data records into alphabetic or numeric order so that you can view the data in a preferred way and also so that you can control the way in which the data records are merged with the main document.

  1. With the main document in the active window, choose the TOOLS-Mail Merge command.

  2. Click the Query Options button in the Mail Merge Helper dialogue box and select the Sort Records tab.

  3. In the Sort By box select the main data field upon which the records should be sorted. If you are certain that the records can be adequately sorted on one data field, then use the Sort Ascending or Sort Descending buttons on the Database toolbar.

  4. Next decide whether your text is to be sorted into Ascending order (A to Z, smallest numbers upwards) or Descending order (Z to A, largest numbers downwards).

  5. In the Then By boxes, decide whether other fields should be used to complete your sort (only two other fields are permitted). WORD will base its main sort on the first field chosen; the second and third sort fields are only used if records with identical information need further sorting.

  6. Choose OK.

The sorting preference information is stored alongside other information pertaining to the data source and therefore every time the data source is opened, the records are automatically sorted into the specified order. All the data records in the data source are sorted, not just selected records. If you do not wish the data source to remain sorted, then you need not save the file on closing.

CLEARING SORTING AND/OR SELECTION CRITERIA

  1. With the main document in the active window, choose the TOOLS-Mail Merge command.

  2. Click the Query Options button in the Mail Merge Helper dialogue box and click the Filter Records tab and/or the Sort Records tab.

  3. Click the down arrow next to the selection criteria/sort field you wish to clear and choose the 'none' option. If you no longer require any selection and/or sort on your data source, then click the Clear All button on both tabs.

Back to the top

See also How to address Envelopes and Mailing Labels using Word for Windows (Office 98)


. . . .