PCgoblin's Blog

Fixing everyday PC problems on my PC

Link documents in Word using relative paths

When inserting Word documents as “links” into a master Word document, paths are entered as absolute references. This means that if you move the linked group of files to another system – even if they are in just one folder – the links no longer work.

Although the Word designers have not allowed an easy option for relative paths, this can be achieved. Thanks to MVP Macropod (Paul Edelstein) for expanding on a solution originally posted in the microsoft.public.word.mailmerge.fields NG by Peter Jamieson, another MS Word MVP.

Using INCLUDEPICTURE fields as an example:

First off, Insert a FILENAME field, with the path switch (see under Insert|Field), anywhere in your document.
Next, press Alt-F9 to reveal your document’s field codes. A FILENAME field will look like:
{FILENAME \p}
and an INCLUDEPICTURE fields will look something like:
{INCLUDEPICTURE “C:\\My Documents\\My Pictures\\Image.png “}
or:
{INCLUDEPICTURE “C:/My Documents/My Pictures/Image.png “}
Some fields might have other switches after the file’s name, which you might want to keep, but they aren’t relevant to the rest of the discussion below. You can find out what the switches are for from Word’s help file, or via Insert|Field.

To make an INCLUDEPICTURE field look in the current folder, cut & paste the FILENAME field into it, replacing the document path and inserting ‘\\..\\’ or ‘/ /’ between that and the hyperlink file’s name, thus:
{INCLUDEPICTURE “{FILENAME \p}/../Image.png”}
or
{INCLUDEPICTURE “{FILENAME \p}\\..\\Image.png”}

How this works: The FILENAME p field extracts the current file’s name and path. The following ‘\\..\\’ or ‘/../’ tells Word to ignore the filename and get just the path. Then all you need to do is to add the source file’s name & extension.

For Macropoint’s posting, which includes information on referring to other folders and a search/replace solution with downloadable macro, see Relative Paths in Word Fields.

Information on field codes in Word 2003 from Microsoft.

Advertisements

January 6, 2013 Posted by | Uncategorized | , | Leave a comment