Reply
 
Thread Tools Display Modes
  #1   Report Post  
George Lagger
 
Posts: n/a
Default relative path within includetext

i need to insert text from one file to another with an "includetext" field,
but doing so i have to specify the full path to the file. When both files
migrate to some other folders, the path obviously changes. Can i use a
'relative' form of the path (smth like ActiveDocument.Path in VB) in the
"includetext" field?
  #2   Report Post  
Ed Kuzemchak
 
Posts: n/a
Default

George,

(I have the same problem, and I have found this partial solution, which I
admit is not optimal)

Word supports relative paths in {includetext} in a funny way - they are
relative to the current working directory of MS Word. One way of setting
the working directory is to do a File/Open and browse to the directory where
your .doc lives, then hit "Cancel". An easier way is to open your .doc
using File/Open in the first place.

Then, you can write {includetext "foo.txt"} and it will pick up foo.txt from
the same directory as your .doc. Or even {includetext "..\\foo.txt"}.

Careful though, any use of the File/Open dialog will cause the working
directory to get reset. Before updating links with F9, be sure to use
File/Open to reset the working dir.

Not great, but it worked for me.


  #3   Report Post  
George Lagger
 
Posts: n/a
Default

Ed, thank you for your attention to the problem

I also found a solution implying a little bit of VB programming:
***
Private Sub Document_Open()
ThisDocument.CustomDocumentProperties("Path") = ThisDocument.Path
End Sub
***

On opening the main document this macro creates a property "Path" (and fills
it with the path to your main doc), which may be used in the includetext
field, e.g.

{ INCLUDETEXT "{DOCPROPERTY Path}\\FileToInclude.doc" }

where "FileToInclude.doc" is the Filename (without path) of your file with
the text to include.

It works (at least in Word 2003), although the path contains single
backslashes instead of doubles.
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linked Objects and path names Colin Higbie Microsoft Word Help 7 January 30th 05 08:51 PM
Relative path in LINK field ? Timvdv Microsoft Word Help 2 January 17th 05 11:41 AM
hyperlink changes address from absolute path to relative tnybecker Microsoft Word Help 2 January 7th 05 08:35 AM
how to make a relative path in a hyperlink in a word-html file? Word Hyperlinks Microsoft Word Help 1 December 15th 04 02:31 PM
Add support for relative path names in master documents Alex Microsoft Word Help 1 November 25th 04 10:43 AM


All times are GMT +1. The time now is 05:50 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"