Using FoxPro Data in a WordPerfect Mail Merge

ID: Q87453

The information in this article applies to:

SUMMARY

To print form letters from WordPerfect using data from FoxPro, you must export the data into a standard WordPerfect mail merge file. To create this file, use the label generator in FoxPro.

MORE INFORMATION

A standard .SDF or delimited file is not compatible with a mail merge file in WordPerfect. A WordPerfect mail merge file marks the end of a field with a ^R character and the end of a record with a ^E character followed by a hard page break.

The easiest way to create a text file for a WordPerfect mail merge is to use the FoxPro label generator. The following label format generates a standard WordPerfect mail merge file:

   ALLTRIM(fname)+ALLTRIM(CHR(18))
   ALLTRIM(lname)+ALLTRIM(CHR(18))
   ALLTRIM(address)+ALLTRIM(CHR(18))
   ALLTRIM(city)+ALLTRIM(CHR(18))
   ALLTRIM(state)+ALLTRIM(CHR(18))
   ALLTRIM(zip)+ALLTRIM(CHR(18))
   CHR(5)+CHR(12)

   Label size:    4" x 1 7/16"
   Number across: 1
   Left margin:   0
   Height:        7
   Width:        80

Note the following items in particular: After creating a label format, create the labels in a text file using the following command:

   LABEL FORM <filename> TO FILE <text filename>

Exit FoxPro and load WordPerfect. Press CTRL+F5 to activate the TEXT IN/OUT menu. Choose item number 1, MS-DOS Text. From this menu, select item number 2 to import the text file created with the LABEL FORM command.

Make the following five modifications to the imported file:

1. At the top of the file, delete the first carriage return/linefeed

   (CR/LF).
2. Press ALT+F2 to invoke the search and replace function. 3. Press N when prompted to confirm each replacement. 4. When asked what to search for, press CTRL+ENTER and ENTER, and then
   press F2.
5. When asked what to replace with, press CTRL+ENTER, then F2.

This procedure searches for, and removes, an extra carriage return inserted after each page break. Save the resulting file in standard WordPerfect format. The file is then ready to be merged into a WordPerfect primary merge file.

After the modifications, the mail merge file looks like the following:

   Dr. David^R
   Fulton^R
   One Microsoft Way^R
   Redmond^R
   WA^R
   98052^R
   ^E
   ======================================================================
   William H.^R
   Gates III^R
   One Microsoft Way^R
   Redmond^R
   WA^R
   98052^R
   ^E
   ======================================================================

The following template file can be used with this mail merge file:

   ^F1^ ^F2^
   ^F3^
   ^F4^, ^F5^ ^F6^

   Dear ^F1^,

   This could be your lucky day! ^F1^ ^F2^, your name has been chosen
   as a finalist in our newest contest...

When the template is merged with the mail merge file, a letter such as the following results:

   Dr. David Fulton
   One Microsoft Way
   Redmond, WA 98052

   Dear Dr. David,

   This could be your lucky day! Dr. David Fulton, your name has been
   chosen as a finalist in our newest contest...

WordPerfect is manufactured by a vendor independent of Microsoft; we make no warranty, implied or otherwise, regarding this product's performance or reliability.

Additional reference words: FoxDos 2.00 2.50 2.50a 2.x word perfect print form letter mailmerge KBCategory: kbinterop kb3rdparty kbprg kbtool KBSubcategory:

Last Reviewed: April 17, 1995