Share via

INCLUDETEXT syntax changes after file is closed

Anonymous
2022-01-11T14:49:25+00:00

Hello,

Since support is not available from the MS 365 admin console, I hope someone here knows the solution:

We're trying to include some text from another word document. The initial syntax looks like this:

{INCLUDETEXT “docname.docx” bookmark}

This works fine until the document is closed and re-opened, when Word automatically changes the syntax to:

{INCLUDETEXT “docname.docx bookmark”}

Notice that the second quote symbol is moved to the end of the line, so naturally the functionality is broken (Error! Not a valid filename.), since the file "docname.docx bookmark" does not exist.

Has anyone resolved this problem?

Thanks, Gregor

Microsoft 365 and Office | Word | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Charles Kenyon 167.4K Reputation points Volunteer Moderator
2022-01-20T16:08:34+00:00

For relative addresses in fields, see also Word Fields and Relative Paths to External Files by Paul Edstein, MVP.

Was this answer helpful?

4 people found this answer helpful.
0 comments No comments

Answer accepted by question author

Jay Freedman 207.7K Reputation points Volunteer Moderator
2022-01-20T02:41:42+00:00

Responding to two of your issues:

  1. The problem with the shifting quote mark is entirely the fault of the Edit Field dialog box. When you select an existing INCLUDETEXT field and open the dialog, the field code is copied into the "Filename or URL" box but the quote marks are stripped out. If you then click OK or click the Field Codes button, the program tries to put the quotes back in, but it doesn't recognize the bookmark as a separate argument of the function. The result is the the entire code is wrapped in one pair of quotes.

The solution is: NEVER use the Edit Field dialog to look at an existing INCLUDETEXT field. Instead, click the Toggle Field Codes item in the context menu or press Shift+F9, and edit the code directly in the document. Yes, you can report this bug, but don't hold your breath waiting for Microsoft to fix it.

  1. You can indeed use relative addresses in the INCLUDETEXT field. The key is knowing that (following on from MSDOS in the mists of time) the folder containing the current document is represented as one period and its parent folder is represented as two periods. For instance, if the file containing the INCLUDETEXT field is in the same folder as source.docx, then this field will work regardless of where that folder is:

{ INCLUDETEXT ".\source.docx" sample \* MERGEFORMAT }

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Doug Robbins - MVP - Office Apps and Services 323K Reputation points MVP Volunteer Moderator
    2022-01-12T00:40:56+00:00

    I cannot replicate the issue here.

    What is the actual field argument that you are using? For example

    { INCLUDETEXT "C:\Users\dkr\Documents\16Macros.docx" MergeTools }

    The only change here after displaying the result of the field, then saving, closing and reopening the host document and looking at the field code, it has inherited a bookmark of the same name as that in the field argument

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2022-01-12T13:34:01+00:00

    Hi Gregor S.

    Thank you for posting in this community and I am sorry for this inconvenience caused to you.

    I can’t replicate the issue either. As you can see the below screenshot:

     

    In this case, to narrow down this issue, it’s first recommended to create a new Word document to see the result. And you may try to go to Insert>Quick Parts>Field to add the field.

    If the issue doesn’t occur in the new document, it means that your current document may be corrupted. Given this situation, you may try to copy and paste the content form the old one to the new one.

    If the issue also happens to the newly created document, it means this issue should be related to your Word app. And you may try the following methods:

    Method 1:

    Please try to open Word in safe mode to troubleshoot whether the issue is caused by some add-ins. If you could open Office apps in safe mode, please  try to temperately disable all add-ins referring  to steps in this article: View, manage, and install add-ins in Office programs - Office Support (microsoft.com)

    Method 2:

    Please  perform an Online Repair for Office.

    If the above suggestions don’t help. Feel free to contact me.

    And for a better understanding of your situation, may I confirm the following information?

    1. The build and version information of your Word? (File>Account.) Could you please share a screenshot on the Product information page and help mask your email address to protect your privacy? Like shown below:
    2. The build and version information of your Windows? (Click the Start menu > Type “winver” > and hit Enter.)

    Best Regards,

    May

    Was this answer helpful?

    0 comments No comments