INCLUDETEXT file path

I

Ian

Using Word 97.

I want to include text in a template, using INCLUDETEXT. When I specify
the *full* pathname of the file containing the text to be included, it
works fine.

But I don't want to specify a full pathname, because the template could
be installed anywhere. For complete portability, I just want to place
the template and the include file in the same folder, but I don't care
where that folder is.

In the template I have tried saying something like

~~~~~~~~~~
{INCLUDETEXT "includefilename.doc"}
~~~~~~~~~~
or
~~~~~~~~~~
{INCLUDETEXT ".\\includefilename.doc"}
~~~~~~~~~~

but the template cannot find the file.

Any ideas on how to tell the template that the include file is in the
same folder as the template?
 
M

macropod

Hi Ian,

There's really no way to avoid using the full path if you're changing the
location of the source file.

If your users are savvy enough, you could ask them to specify the path using
FILLIN field embedded in the INCLUDETEXT field. Otherwise, you might like to
check out the Word file at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=261488
(url all one line)
This has a macro for updating INCLUDETEXT paths, and you might be able to
use it as is or adapt it to your needs.

Cheers
 
M

macropod

PS: If you use a FILLIN field to get the path, the double backslashes aren't
needed.

Cheers
 
C

Cindy M -WordMVP-

Hi Ian,

Generally, Word works poorly with relative file paths. Word can work with
a relative file path under some circumstances IF that path also happens to
be the currently active directory (i.e. the document you just opened sets
that directory and the link to another file is in that same directory).

Later versions of Word with improved Web capability do somewhat better
than earlier versions, as a rule.

Try putting one or two dots in front of the \\ in the sample you show:
..\\Filename.doc

More reliable is to use a full path. In the case you describe, you can put
the path information in a custom document property, then update the
property (use an AutoOpen macro) depending on what folder the attached
template is in...
Using Word 97.

I want to include text in a template, using INCLUDETEXT. When I specify
the *full* pathname of the file containing the text to be included, it
works fine.

But I don't want to specify a full pathname, because the template could
be installed anywhere. For complete portability, I just want to place
the template and the include file in the same folder, but I don't care
where that folder is.

In the template I have tried saying something like

~~~~~~~~~~
{INCLUDETEXT "includefilename.doc"}
~~~~~~~~~~
or
~~~~~~~~~~
{INCLUDETEXT ".\\includefilename.doc"}
~~~~~~~~~~

but the template cannot find the file.

Any ideas on how to tell the template that the include file is in the
same folder as the template?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
I

Ian

Macropod, thanks for the link to www.wopr.com. It seems that I am not
alone in trying to crack this one!

I think I have discovered when relative paths for INCLUDETEXT statements
*do* work; namely when the include text file is located in the same
folder as the folder from which Word is launched. That is, a relative
path is relative to the VBA "CurDir" value. Otherwise it doesn't work.

Obviously it is unrealistic to specify where a user must launch Word
from, so in desperation I have now decided that the include text file
must always go in C:\Windows\temp, on the assumption that every user of
Win95/98/2K/XP etc etc will have this folder already.

HOWEVER, I am uncertain about whether ordinary (i.e. non-administrator)
users will always be allowed to write into C:\Windows\temp. Would an
administrator ever assign read-only permission to this folder for
ordinary users (thus preventing the user from saving the include text
file there)?
 
C

Charles Kenyon

Another problem is that standard maintenance often included deleting
everything in the Temp folder.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
S

Suzanne S. Barnhill

That was my first thought, too, and would cause me serious concern.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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