I hate 'Error! Reference source not found'!

J

Jack G

I use a template for letters which bookmarks a project number that appears
at the top of the letter, and then any subsequent pages have a reference
field pointing to it in their headers.

The problem is that we often delete the project number bookmark on the first
page (intentionally or accidentally) and then the reference field returns
the ugly message, "Error! Reference source not found". Unfortunately, you
don't even notice until it's printed (or perhaps until after it's been
mailed out)!

I've tried without success to replace the simple reference with something
like =IIf (ProjectBookmark, ProjectBookmark, "") but I can't seem to get
the syntext right or just plain don't know how to do it.

Has anyone found a solution for this??

Jack
 
S

Stefan Blom

You can try the following nested fields (of course, "test" should be
replaced with *your* bookmark name):

{ IF { REF test } = "Error! Reference source not found." "" "{ REF
test }" }

Press Ctrl+F9 to insert each pair of field delimiters, { }. Press F9 to
update. Use Alt+F9 to show/hide field codes.

Note that this assumes that "Error!..." is the exact error message that
is occurring. Of course, if you are sending documents to people using a
different language version of Word, the error message will also be
different, and the code won't work. To get around this, you would have
to get more creative. Peter Jamieson has suggested this approach:

{ SET errmsg { REF NonExistingBookmark } }

{ IF { REF test } = { REF errmsg } "" "{ REF test }" }

Here, "test" should be replaced with your bookmark name, but
NonExistingBookmark should be used (the point is that it should be
non-existing and therefore generate the error message).

For more, see the following thread:

Checking to see if a field reference or bookmark exists
http://groups.google.se/group/micro...gement/browse_thread/thread/17b44a4a15ef8de4/

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
J

Jack G

Thanks, Stefan. That's much better! I used the first method, and (after
figuring out that I couldn't just paste your stuff in and that I needed to
use the Ctrl+F9 you talk about) it's working as I had hoped.
 
S

Stefan Blom

You are welcome.

As I wrote, the first suggestion assumes that you know the exact error
message, while the second suggestion is the elegant one (and sometimes
the necessary one).
 

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