Relative Path in INCLUDETEXT

G

Guest

I'm attempting to include a number of small documents within a larger
document. The small documents are in a subfolder called "Modules." It worked
very well when I used the Insert-File command, but the documents disappeared
when I moved the big document to another computer--but to a folder that had
the same subfolder ("Modules") and smaller documents.

I am trying to change the INCLUDETEXT statement to include a relative path,
instead, but every attempt gives me the "Error! Not a valid filename."

I've tried:
{INCLUDETEXT "...\\Modules\\Module 4.htm" \c HTML}
{INCLUDETEXT "\\Modules\\Module 4.htm" \c HTML}
{INCLUDETEXT "Modules\\Module 4.htm" \c HTML}

What is the right syntax for a relative path within an INCLUDETEXT field, or
is a relative path even possible?

Thanks,
Donna
 
H

Herb Tyson [MVP]

Actually, it works, but not the way you're thinking. The path used is
dynamic with respect to Word's current directory -- not with respect to the
folder containing the file that's open.

Suppose, for example, that Module4.htm is located here:

c:\Project\Modules\Module4.htm.

If you choose File - Open and navigate to the c:\Project folder, then the
following works:

{includetext "Modules\\Module4.htm"}

This works because Modules is now a subfolder in Word's currently logged
folder. If, however, you navigate to:

c:\Project\Modules

The same includetext field no longer works. It would work if Module4.htm
were in c:\Project\Modules\Modules.

If you can manipulate Word to log to a specific starter folder, you're okay.
But, keep in mind that relative means relative to where Word itself is
pointing, which might not be where the current file is located.

The reason this almost always fails is that the user navigates to the
location of the file to be includetext'd. This now means that Word is
pointing at THAT folder. If you simply navigate back to the previous level,
the relative reference will work.

Clear as mud?
 

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