Share via

How to fix Includetext-bookmark - Error! Not a valid filename.

Edmund Erikstad 20 Reputation points
2026-03-06T10:23:00.8233333+00:00

I click CTRL+F9 and type in this:
INCLUDETEXT  C:\Users\[Moderator note: personal info removed]\OneDrive - [Moderator note: personal info removed]\Dokumenter\[Moderator note: personal info removed] - Service - Dokumenter\General\2 - Service og brukermanualer\2 - Service and maintenance\20 - Master filer + Maler\4 MASTER Operations\221-005 Lubrication 50hours.docx "OP"

This results in Error! Not a valid filename.

I then right click - Edit field - Field codes and find this code:

INCLUDETEXT "C:\Users\[Moderator note: personal info removed]\OneDrive - [Moderator note: personal info removed]\Dokumenter\[Moderator note: personal info removed] - Service - Dokumenter\General\2 - Service og brukermanualer\2 - Service and maintenance\20 - Master filer + Maler\4 MASTER Operations\221-005 Lubrication 50hours.docx OP"

I then rename the code to:
INCLUDETEXT "C:\Users\[Moderator note: personal info removed]\OneDrive - [Moderator note: personal info removed]\Dokumenter\[Moderator note: personal info removed] - Service - Dokumenter\General\2 - Service og brukermanualer\2 - Service and maintenance\20 - Master filer + Maler\4 MASTER Operations\221-005 Lubrication 50hours.docx"OP"

This solves the problem, but still annoys me why it doesnt work at first input. Ive tried numerous fixes to no good.

Microsoft 365 and Office | Development | Other
0 comments No comments
{count} votes

Answer accepted by question author
  1. Stefan Blom 335.2K Reputation points MVP Volunteer Moderator
    2026-03-06T14:48:53.7266667+00:00

    The INCLUDETEXT field requires double backshlashes rather than just single ones.

    Also, any bookmarks must be put outside of the path, as suggested by Gabriel-N.

    See https://support.microsoft.com/en-gb/office/field-codes-includetext-field-1c34d6d6-0de3-4b5c-916a-2ff950fb629e .

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Gabriel-N 14,775 Reputation points Microsoft External Staff Moderator
    2026-03-06T13:01:20.85+00:00

    Please note that Q&A forum is a public platform, and moderators will modify the question to hide personal information in the description. Kindly ensure that you hide any personal or organizational information the next time you post an error or other details to protect personal data.

    Hello Edmund Erikstad

    Thank you for reaching out to the Q&A Forum.

    The official and documented syntax of the INCLUDETEXT field is: { INCLUDETEXT "filename" bookmark } where the file path must be provided as a single quoted argument, and the bookmark name must be specified as a separate parameter outside the quotation marks.

    In your first and second examples, the error occurs because the file path is not fully enclosed in quotation marks when Word initially parses the field, which leads to the “Error! Not a valid filename” message.

    When the field is written as: INCLUDETEXT "C:\...\221-005 Lubrication 50hours.docx"OP"

    Word is able to correctly detect the content inside the double quotation marks as a valid file path and successfully locate the source document. It then resolves OP as the bookmark within that document.

    Although this format works, it does not strictly follow the documented syntax. My understanding is that this behavior is likely due to Word’s tolerant field‑code parsing. When Word detects a valid document extension (such as .docx) followed by additional characters that cannot be part of a filename, it may attempt to recover by implicitly separating the trailing text and interpreting it as the bookmark name.

    This behavior also aligns with the documentation : How to Use IncludeText Fields, which notes that file path handling in INCLUDETEXT fields can be intermittent and unreliable when the syntax is not explicit.

    This documentation also suggests the following workarounds to improve reliability:

    Workaround 1: Use relative file paths and define a Hyperlink Base under File > Properties, so Word consistently resolves relative paths from that base location.

    Workaround 2: Use absolute file paths stored in a custom document property (File > Properties > Custom) and reference that property via a DOCPROPERTY field, for example: { INCLUDETEXT "{ DOCPROPERTY LinkFilePath }Source.docx" Bookmark }

    Note: This information is provided as a convenience to you. These sites are not controlled by Microsoft, and Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please ensure that you fully understand the risks before using any suggestions from the above link.

    I hope this explanation helps clarify the observed behavior. If you have any other questions, please feel free to let me know.


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.  

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.