Document Editing Problems

Fix Word Error: File Name Not Valid in INCLUDETEXT Fields

Aamir Naveed AkramAamir Naveed Akram Nov 2, 2026 869 views

Question details

The user needs to resolve an invalid file name error that occurs when utilizing INCLUDETEXT fields to insert external content into mail merge documents.

How to Fix the 'File Name Not Valid' Error in Word INCLUDETEXT Fields
Product
Microsoft Word / WPS Writer
Device & OS
not provided
Scenario
Running a mail merge document that relies on an INCLUDETEXT field to dynamically pull in text or content from a separate external document file.
Observed behavior
Instead of displaying the content from the target file, the document displays the error message 'Error! File name not valid'.
Before you start

Ensure you know the exact folder path of the document you are trying to include and verify that the target file is accessible on your computer.

Solution 1Recommended

Double the Backslashes in the File Path

The most common cause of this error is single backslashes in the Windows file path, which the word processor misinterprets as special switch codes rather than folder separators.

In field codes, a single backslash is considered an escape character used to trigger specific commands or switches. To specify a standard file path, you must escape the backslash itself by doubling it, or alternatively use single forward slashes.

1
Display the field codes

Open your document and press Alt + F9 (or Alt + Fn + F9 on some laptop keyboards) to toggle the view from the error message to the actual field codes.

2
Locate the INCLUDETEXT path

Find the INCLUDETEXT field that is causing the error. You will see a file path inside quotation marks, such as "C:\MyFolder\MyDocument.docx".

3
Format the backslashes

Edit the file path by changing every single backslash (\) to a double backslash (\\). The corrected path should look like "C:\\MyFolder\\MyDocument.docx".

4
Update the fields and run the merge

Select the field and press F9 to update it, verifying the text now loads correctly. Once confirmed, run your mail merge process again.

Double the Backslashes in the File Path
Hide Field Codes: Once the file path is fixed and the error is resolved, you can press Alt + F9 again to hide the field codes and return to the normal document view.
Seamless Mail Merge with WPS Office

Perform Mail Merge and Manage Field Codes Easily in WPS Writer

WPS Writer provides an intuitive and powerful Mail Merge feature that fully supports INCLUDETEXT fields, allowing you to combine and pull data from external documents flawlessly without syntax headaches.

  1. 1. Open your document: Launch WPS Writer and open your primary document. Navigate to the 'Mailings' or 'References' tab to access the Mail Merge tools.
  2. 2. Insert field codes: Click 'Insert Field' to add your INCLUDETEXT codes or merge fields directly into the desired section of your document.
  3. 3. Verify file paths: Use the Alt + F9 shortcut to toggle the display of your field codes, ensuring any included file paths use double backslashes for accurate reading.
  4. 4. Complete the merge: Click 'Merge to New Document' or 'Merge to Printer' to instantly generate your finalized, error-free combined documents.
Fully compatible with Microsoft Word .docx formats and standard field codesIntuitive Mail Merge wizard to streamline dynamic document creationFree to download and lightweight on system resourcesAdvanced field code formatting and easy toggle shortcuts
microsoft office alternative - wps office

Frequently Asked Questions

What does INCLUDETEXT do in a document?

The INCLUDETEXT field is used to insert the complete contents of one document into another. It is highly useful for mail merges, templates, and dynamic reports where standard text blocks need to be pulled from a master file.

Are there other ways to format the file path in INCLUDETEXT besides double backslashes?

Yes. Alternatively, you can use single forward slashes (/) instead of double backslashes (e.g., "C:/MyFolder/MyDocument.docx"). The field code engine parses forward slashes correctly as directory separators.

Why didn't updating the field fix my document?

If doubling the backslashes does not resolve the issue, check that the file path is completely correct, the target file hasn't been moved or renamed, and that the entire path is enclosed within standard straight quotation marks (not smart quotes).

How do I update a specific field without updating the whole document?

Simply click or highlight the specific field you want to refresh, then right-click and choose 'Update Field', or press the F9 key on your keyboard.