IncludeText with relative path

A

Anderflash

I have this text from a site:
-------------------------------------------------------------------------------------
When Word sees a relative filepath in a document, instead of checking the
filepath against the filepath of the document, Word uses the currently active
folder to check the relative filepaths. For instance, if you opened the
target doc, then opened the source doc, Word will measure all filepaths
against the source doc, as that is the currently active folder. In the target
doc, your relative filepaths will suddenly stop working and will show Error!
Cannot open file. If you only open the target doc, however, or reopen the
target doc after opening the source doc, the relative filepaths will work
fine after updating them. Again, always be sure to update fields regularly,
as sometimes everything will look okay but fail when you attempt to update
it. Or vice versa—updating can fix a field that looked entirely incorrect.

The really annoying thing about this behavior is that it's guaranteed to be
intermittent. It will only cause a problem some of the time. You can go
through the same actions, and sometimes all your links will fail, and
sometimes they won't (since most of us don't pay attention to the invisible
setting for the currently active folder in Word).

Workaround 1: use absolute filepaths, but create a custom document property
to store the base filepath (File>Properties>Custom). Then use a DocProperty
field to carry the path info into the IncludeText fields. You can easily
change the custom document property in File>Properties. The nested fields
might look like this:

{ INCLUDETEXT "{ DOCPROPERTY LinkFilePath }Source.doc" Bookmark }

Workaround 2: use relative filepaths, but go into File>Properties and set a
“hyperlink base†for the document. Then Word should read all relative
filepaths from that base, instead of checking against the currently active
folder. Help says this works, but some people have had problems with it.
------------------------------------------------------------------------------------

Can someone explain me or give me an example about these Workarounds?
I think the Workaround 1 isn't what I want, because I don't want the user
changes the custom property each time he moves the document.
And about the Workaround 2, how do I use the hyperlink base property to make
the path relative? If the user moves the document, does this procedure work?
 
P

Peter Jamieson

It is only my personal opinion, but I see no evidence that the "hyperlink
base" approach works at all, and suspect it is nothing more than an
untested theory. Perhaps if you get the hyperlink base syntax exactly right
it can be made to work, but perhaps it is also significant that the article
you quote does not provide concrete examples.

The "Properties" approach is AFAIK workable as long as you do not have
problems resulting from the setting of Tools|Options|General|Web
options|Files|"Update links on save"

There is another approach you can consider: suppose the file you want to
include is called "abc.ext" and is in the same folder as the including
file - try:

{ INCLUDETEXT "{ filename /p }\\..\\abc.ext" }

and take it from there. You should find that other "relative naming" also
works, but it may depend on having a certain version of Word etc. - in other
words, I wouldn't want to rely on this sort of stuff working.

Peter Jamieson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top