Link a Field to an Embedded Worksheet & have the link follow "save

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This has to be the most frustrating thing I've seen. The application is
almost there... It seems like this would be the logical next step.

I started by created an .xls and linking about 20 fields in my .doc to the
..xls. Everything was working great until I needed to change the file names
from "template" to "[clientname]".

I realized that if I have the template.doc open with all the links
auto-updating, and I SAVE AS the .xls, most of the links follow the new .xls
file name. Then I can Save As the .doc and ta-da. But it wasn't perfect and
sometimes the links did not follow the filename.

So then I got the idea of embedding a worksheet as an object into the .doc
and link to it instead of linking to a source file. But the Link needs to
refer to the path of the document and then to the objectID and r/c
referrence. If I Save As the .doc, none of the links follow the new
filename. They all still link to the full path of "c://mydoc//template.doc"
_12345Sheet!rXcY.

One, is there a better way to accomplish what it is I'm trying to do?

Two, is there a way to set up a link so that the path is the current
document name regardless of the name of the current document?

Thanks a million in advance.

- Drew
 
Hi =?Utf-8?B?RHJldw==?=,
This has to be the most frustrating thing I've seen. The application is
almost there... It seems like this would be the logical next step.

I started by created an .xls and linking about 20 fields in my .doc to the
..xls. Everything was working great until I needed to change the file names
from "template" to "[clientname]".

I realized that if I have the template.doc open with all the links
auto-updating, and I SAVE AS the .xls, most of the links follow the new .xls
file name. Then I can Save As the .doc and ta-da. But it wasn't perfect and
sometimes the links did not follow the filename.

So then I got the idea of embedding a worksheet as an object into the .doc
and link to it instead of linking to a source file. But the Link needs to
refer to the path of the document and then to the objectID and r/c
referrence. If I Save As the .doc, none of the links follow the new
filename. They all still link to the full path of "c://mydoc//template.doc"
_12345Sheet!rXcY.

One, is there a better way to accomplish what it is I'm trying to do?

Two, is there a way to set up a link so that the path is the current
document name regardless of the name of the current document?
In a nutshell: to have this work reliably, without user intervention, you need
to use VBA (program a macro).

In general, the first approach, with the separate Excel file, is going to be
more stable and easier to maintain (although not to distribute). If the links
are all "in-line" with the text, you can do Alt+F9 (display field codes),
Find&Replace for the new path and/or file name, Alt+F9 (hide the field codes).

Another approach is to create a custom document property with the information,
then use a DocProp field within the LINK fields to bring in the full path. This
has the advantage of being able to make the change in just the one place for the
entire document.

Either of these techniques can be automated using VBA.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

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

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

Back
Top