Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / January 2005

Tip: Looking for answers? Try searching our database.

relative path within includetext

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George Lagger - 20 Jan 2005 15:57 GMT
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?
Ed Kuzemchak - 26 Jan 2005 22:31 GMT
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.
George Lagger - 27 Jan 2005 15:15 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.