Nested Merge with IncludeText Field Does Not Merge File

ID: Q119946


The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Windows 3.1


SYMPTOMS

You may receive several errors when you try to nest a merge field within the IncludeText field. (Note: For compatibility with earlier versions of Word for Windows, you can use Include instead of IncludeText.) If your document contains the following field

{IncludeText {mergefield <filename>}}
where <filename> represents a field that contains a valid path and filename, and you select the View Merged Data option before merging your main document and data file, you will get the following error message:
Error! Not a valid filename"
When performing the merge to a document or to the printer, you will receive the following error message
A field calculation error occurred in Record <record number>.
where <record number> is the number of the record being merged. This error repeats for each record in the data document, and the resulting document will contain the message:
Error! Not a valid filename
If you first merge to a new document (not to the printer), you can select the field in the merged document and press F9 to update the merge field. If the data record originally contained full path information (for example, C:\PATH\FILENAME), you will get the following error and you will not be able to include the document in your merge:
Error! Filename not specified!
If the original data record contains only the filename and the file is in the current directory, the field will update at this point, without an error.

This type of merge works correctly in Word version 2.x.


CAUSE

As the field updates, it reads the field braces of the nested field and interprets the braces as part of the path. Since field braces are not valid characters in a path, you receive the above errors.


STATUS

Microsoft has confirmed this to be a problem in Word versions 6.0, 6.0a, and 6.0c for Windows. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


WORKAROUND

If the {mergefield <filename>} refers to data that contains a path, first format the field braces as hidden. Since you cannot select a single field brace without selecting the entire field, you must first format the entire field as hidden, then format the field type ("mergefield") and field instructions (the data field name) as not hidden. Use the following steps to do this:

  1. Select the field ({mergefield filename}).


  2. From the Format menu, choose Font. Under Effects, select Hidden and then choose the OK button.


  3. Select the text inside the field braces only.


  4. From the Format menu, choose Font. Under Effects, clear the Hidden option then choose the OK button.


  5. Your new document will contain the error:
    Error! Not a valid filename.
    Choose Select All or press CTRL+A to highlight the entire document.


  6. Press F9 to update the fields.

    Note: If you skip steps 3 and 4, your new document will contain a hidden path and filename that will generate the following message, and you will not be able to update the field:
    Error! Filename not specified!


Additional query words: 6.0 winword include word6 includetext merge mergefield error err field calculation filename not specified invalid

Keywords : kbprint kbmerge
Version : WINDOWS:3.1,6.0,6.0a,6.0c
Platform : WINDOWS
Issue type :


Last Reviewed: December 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.