Filename in a macro - relative path

M

MIrving

In a macro, I have includetext codes (that link to a number of files). I
would like the filepath in the macro to be setup so that if I move the source
files to a different location, the macro still finds the file. How do I do
this?

Thank you for any suggestions?
 
H

Helmut Weber

Hi MIrving,

yes, would be nice to have.

In theory, I think, it can be done,
if you don't care about processing time,
but I wouldn't recommend trying it.

I don't know of a faster way to check,
whether a link points to a valid location,
except searching for it, like:
C:\>dir c:\office2003\clipart\PUB60COR\PH01179J.JPG /s /b > c:\pic.txt

Or use some of the fileexists-functions available on the net.
You'd have to parse out the filepath and name
from the field's code beforehand.

If the file exists there, everything is alright.
If not, parse out just the filename from the field's code,
and search all resources for that file.
Might work on a local workstation.

With millions of files on terabyte servers,
you are at a loss.

As soon as found, get the path,
change the field's code to the new location, update fields.

In addition, you'd have to wait for the shell-commands
to complete. Various methods available on the net.

Maybe I am on the wrong track...
--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
J

Julie

Here's an idea. I have it on my task-list to try this out myself, so it
works for you, please post back.

You might create an autotext entry in a global template containing the path,

e.g. for my sample, the autotext entry "PIPrecPath" contains the location of
the included files:

c:\\wordsys\\prod\\templates\\prec\\pi\\inserts\\

Then use the Autotext field inside the includeText field

{ INCLUDETEXT "{AUTOTEXT PIPrecPath }sop2T.DOT" "PI_SOP2" }

I tested this with the autotext entry resident in Normal.dot which isn't the
best place for it in the real world. I would imagine it would work the same
if resident in a startup global template which is where it should go.

I do similar thing now, but with a {DocProperty} field in lieu of the
autotext field but intend to change it to use the {Autotext} field if no
issues are encountered. My {DocProperty} field gets filled by my macro at
assembly time, but it would be nice to have it always correct at DESIGN time
as well, which is why I am considering the change to use the Autotext field.

Hope this helps,
Regards, Julie
 

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