Conditionally insert text strings from second document

P

Pete

I need to keep select text strings in a second document( Easy).

Now, from another document I need to:
include text strings from the second document
if the document is not present, insert a fixed string (e.g. "UnKnow")

This would be done through out the main document with possibly a
hundred references .

I thought about using a section at the end of the document and
inserting the strings using the insert caption. However, if i remove
the last section, all of the reference give the standard "ERROR"
message which I can not allow in the document.

Any IDEAS.
 
C

Cindy M -WordMVP-

Hi Pete,
I need to keep select text strings in a second document( Easy).

Now, from another document I need to:
include text strings from the second document
if the document is not present, insert a fixed string (e.g. "UnKnow")

This would be done through out the main document with possibly a
hundred references .
We are talking about Word, I take it?

You can bookmark each "unit", then use an IncludeText field to pick up
the string; nest it in an IF field to catch the error that will be
thrown if the path can't be found. (Or InsertFile if we're talking about
bringing them in without a link.)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :)
 
P

Pete

It has taken me some time to get back to this issue. Thanks for the
response.

I have tried to make this work and I am still having some problems.

First this is Word that I am talking about.

I have a document that contains a simple line of text.
" you must "XX" not more than "XX" items. "
I have created a second document that contain two values:
200 and "Test".

If the second document is available, I need to replace the "XX" data
with one of the values in the second document.

If the second document is not available, replace the "XX" with "N/A".

I am haivng trouble using the bookmark suggestion. It is quite
possibly a misunderstaning of how the suggestion will work.

Can you provide a little more detail, Specifically, what must I do to
make it work?

how do you create a bookmark that contains the value (I can not seem to
get this to work)?

Please give me a sample of the if statement that captures the error.
 
C

Cindy M -WordMVP-

Hi Pete,
how do you create a bookmark that contains the value (I can not seem to
get this to work)?
Let's start here

Select the text (200, for example), then Insert/Bookmark and give it a
name.

When you're done, if the bookmarks are being shown (Tools/Options/View)
it should look like
[200]

In the other document, select XX and press Ctrl+F9 to put it into field
braces for the IF evaluation. The basic field should look like this, you
can use Insert/File with a link and using the Range button to create the
IncludeText fields (Alt+F9 will toggle the field codes on/off):

{ IF { IncludeText "C:\Path\doc.doc" BookmarkName } = "" "N\A" "{
IncludeText "C:\Path\doc.doc" BookmarkName }" }

It's quite likely that the IncludeText will NOT evaluate to an empty
string if the file is missing. Instead, it will probably give an error
message. You need to put this error message, exactly as it stands, in the
"" for this to evaluate correctly.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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

Top