Hi gvm,
Have you tries setting the hyperlink base? See Word's Help file for the details. Even with the hyperlink base set, I suspect you'll
need to re-set it for each location the files are run from.
Other than that, you can use field coding in Word if the source and target documents can be guaranteed to have the same relative
path between them, but this gets complicated once you start going across directory trees - and doesn't work if the files are on
different drives. Even when it does work, I'm not sure the hyperlink path you get by hovering the mouse of the hyperlink will
display correctly. The field coding is far from obvious, so here's a few pointers:
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. The FILENAME field will look like:
"{FILENAME \p}
and the hyperlink fields will look something like:
{HYPERLINK "C:\\DocSystem\\Main \\Filename.Ext"}
or :
{HYPERLINK "C:\\DocSystem\\Main \\Filename.Ext" \l "BookmarkName"}
The hyperlink fields might have other switches after the file's name, which you'll probably 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|Hyperlink.
Then, to make an HYPERLINK field look in the current folder, copy & paste the FILENAME field into it, replacing the document path
and inserting '\\..\\' between that and the hyperlink file's name, thus:
{HYPERLINK "{FILENAME \p}\\..\\Filename.Ext"}
How this works: The FILENAME \p field extracts the current file’s name and path. The following '\\..\\' 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.
The same approach can be extended to implement a form of relative addressing. For example:
{HYPERLINK "{FILENAME \p}\\..\\My Pictures\\Filename.Ext"}
looks in the child folder named 'My Pictures' and:
{HYPERLINK "{FILENAME \p}\\..\\..\\Filename.Ext"}
looks in the parent folder, while:
{HYPERLINK "{FILENAME \p}\\..\\..\\My Pictures\\Filename.Ext"}
looks in the parent folder, then its child folder named 'My Pictures' (a sibling folder, if you like). Do note that, whilst you can
go down the file tree by adding however many sets of '..\\' you need, you've got to give explicit folder names for navigating back
up it.
The same technique works with INCLUDETEXT, INCLUDEPCTURE & RD fields, but not with LINK fields.
Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------
gvm said:
I synchronise my word documents with copies kept on an external drive. Since
hyperlinks use the C drive as the root of the path address, the links don't
work on the synchronised copy. How do I configure the link addresses to be
relative to the folder of the current document, so for example, if the linked
document is in the same folder, then the path address will consist only of
the filename?
TIA ... Greg