Thursday, 28 May 2015

Make Word single-source many snippets of text

There is a lot of advice on the web about how to single-source a small number of snippets between Word documents. This works nicely if you just want to share a few things, such as names, dates, and company names.

Today I am trying to work out how to single-source glossary terms in longer topics. I expect that I'll end up with a few hundred glossary terms, each with its own definition. I want to be able to include these definitions in other Word documents, without copying and pasting them.
I've decided to try using bookmarks. I'm using Word 2007.

The following instructions use steps I found at these sites:
http://wordribbon.tips.net/T010803_Referencing_Fields_in_Another_Document.html
http://windowssecrets.com/forums/showthread.php/154379-Word-Fields-and-Relative-Paths-to-External-Files

In these instructions, the source document holds the glossary terms and definition, and the target document holds longer topics that re-use the definitions.

Set up the bookmarks

  1. In the source document, write a definition for each term.
  2. Select a definition (including the final full stop but not the paragraph mark).
  3. Click Insert, Bookmark, then type the term that this definition applies to, replacing any spaces in the bookmark name with underscores.
  4. Click Add to create the bookmark.

Include the text for a single glossary term

  1. In the target document, select the Insert tab, then select Object, Text from File.
  2. In the Insert File dialog, select the source document, then select Insert as Link in the Tools menu in the bottom right. The entire contents of the document are inserted in the target document.
  3. Place the cursor in the middle of the inserted text and type Alt-F9 to display the field code, which will look similar to this:
    { INCLUDETEXT “D:\\Users\\Documents\\glossary.docx }
  4. Add the name of the relevant bookmark to the field code, so that it looks like this:
    { INCLUDETEXT “D:\\Users\\Documents\\glossary.docx term }
  5. Refresh the field to check that it is displaying the correct definition:
    1. Place the cursor in the middle of the field code and type Alt-F9 to switch to the field output.
    2. Press F9 to update the field's content.

Make the field use a relative filepath by using a FILENAME field

  1. Click anywhere in the document, then select Insert, Quick Parts, Field.
  2. Select the FILENAME field, check the Add path to filename box, deselect the Preserve formatting during updates box, then click OK.
  3. Ensure that field codes are displayed (Alt-F9), then copy the entire new FILENAME field and paste it into the INCLUDETEXT field, replacing the current path.
  4. Add an extra \\.. to the path immediately before the filename.
    The field should now look similar to this:
    { INCLUDETEXT “{FILENAME \p}\\..\\glossary.docx term }
  5. Delete the FILENAME field.
  6. Refresh the field to check that it is still displaying the correct definition.

Add subsequent definitions

Now that you have one good field code, you can copy and paste this rather than following all of the previous steps to generate it. Repeat these steps for every subsequent definition that you want to include.
  1. Display the field codes (Alt-F9).
  2. Copy the entire field code, then paste it where you want to see the definition.
  3. Carefully change the bookmark name.
  4. Display the field contents (Alt-F9) and then refresh the field (F9).