A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Checking to see if a field reference or bookmark exists.



 
 
Thread Tools Display Modes
  #1  
Old March 28th 07, 04:06 AM posted to microsoft.public.word.docmanagement
[email protected]
external usenet poster
 
Posts: 1
Default Checking to see if a field reference or bookmark exists.

Hello,
We have a word document that we use as a template. Pretty much all
the sentences in the document are autonumbered. At the end of the
document we have a summary section, as indicated below:

[{Autonumber 2.1}]* Some text
.....
.....
{Autonumber 3} b Summary /b
{Autonumber 3.5} ... as per {2.1}

[]* Word automatically bookmarks as a hidden bookmark, e.g."
_Ref158707320".

However, sometimes certain sentences are not required, so we delete
them. This results in:
{Autonumber 3.5} ... as per {Error! Bookmark not found}.

Is there any way to conditionally check for the existence of the
bookmark? I'm thinking of something along the lines of:
{Autonumber 3.5} ... {if exist{_Ref158707320} then concatenate "as per
", & {_Ref158707320} else "None"}


Cheers,
Tim

Ads
  #2  
Old March 28th 07, 09:33 AM posted to microsoft.public.word.docmanagement
Peter Jamieson
external usenet poster
 
Posts: 4,583
Default Checking to see if a field reference or bookmark exists.

You can always try

{ IF "{ REF _Ref158707320 }" = "Error! Bookmark not found."
"None"
"as per { REF _Ref158707320 }" }

NB, you need the REFs in at least some of these fields - if you just use {
_Ref158707320 } you will probably see the error anyway.

However, you might also get the message

Error! Reference source not found.

and if your document happens to be used internationally you might have a
different message altogether.

So maybe you could put the following at the beginning of your document

{ SET noref { REF __ } }

then use

{ IF "{ REF _Ref158707320 }" = "{ noref }"
"None"
"as per { REF _Ref158707320 }" }

or if you want to play safe,

{ IF "{ REF _Ref158707320 }" = "{ REF noref }"
"None"
"as per { REF _Ref158707320 }" }

Peter Jamieson

wrote in message
ps.com...
Hello,
We have a word document that we use as a template. Pretty much all
the sentences in the document are autonumbered. At the end of the
document we have a summary section, as indicated below:

[{Autonumber 2.1}]* Some text
....
....
{Autonumber 3} b Summary /b
{Autonumber 3.5} ... as per {2.1}

[]* Word automatically bookmarks as a hidden bookmark, e.g."
_Ref158707320".

However, sometimes certain sentences are not required, so we delete
them. This results in:
{Autonumber 3.5} ... as per {Error! Bookmark not found}.

Is there any way to conditionally check for the existence of the
bookmark? I'm thinking of something along the lines of:
{Autonumber 3.5} ... {if exist{_Ref158707320} then concatenate "as per
", & {_Ref158707320} else "None"}


Cheers,
Tim



  #3  
Old March 21st 19, 01:59 PM
thosecars82 thosecars82 is offline
Junior Member
 
First recorded activity by WordBanter: Jul 2009
Posts: 2
Default

Quote:
Originally Posted by Peter Jamieson View Post
You can always try

{ IF "{ REF _Ref158707320 }" = "Error! Bookmark not found."
"None"
"as per { REF _Ref158707320 }" }

NB, you need the REFs in at least some of these fields - if you just use {
_Ref158707320 } you will probably see the error anyway.

However, you might also get the message

Error! Reference source not found.

and if your document happens to be used internationally you might have a
different message altogether.

So maybe you could put the following at the beginning of your document

{ SET noref { REF __ } }

then use

{ IF "{ REF _Ref158707320 }" = "{ noref }"
"None"
"as per { REF _Ref158707320 }" }

or if you want to play safe,

{ IF "{ REF _Ref158707320 }" = "{ REF noref }"
"None"
"as per { REF _Ref158707320 }" }

Peter Jamieson

wrote in message
ps.com...
Hello,
We have a word document that we use as a template. Pretty much all
the sentences in the document are autonumbered. At the end of the
document we have a summary section, as indicated below:

[{Autonumber 2.1}]* Some text
....
....
{Autonumber 3} b Summary /b
{Autonumber 3.5} ... as per {2.1}

[]* Word automatically bookmarks as a hidden bookmark, e.g."
_Ref158707320".

However, sometimes certain sentences are not required, so we delete
them. This results in:
{Autonumber 3.5} ... as per {Error! Bookmark not found}.

Is there any way to conditionally check for the existence of the
bookmark? I'm thinking of something along the lines of:
{Autonumber 3.5} ... {if exist{_Ref158707320} then concatenate "as per
", & {_Ref158707320} else "None"}


Cheers,
Tim
I gave this a try but I did not get this to work. Is this solution supposed to work?

Last edited by thosecars82 : March 21st 19 at 02:02 PM.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cross-reference doesn't show graphic in bookmark alligatormaki Microsoft Word Help 1 February 28th 07 08:50 PM
How does one reference the VALUE of a FORMCHECKBOX bookmark? Robert Kleinschmidt Microsoft Word Help 4 October 8th 05 10:22 PM
SEQ Field not in cross-reference reference type pull-down menu The Josh Microsoft Word Help 5 May 25th 05 02:27 PM
cross reference bookmark annoyed word user Microsoft Word Help 0 February 14th 05 09:21 PM
Reference to Bookmark in header not updating Barb Reinhardt Microsoft Word Help 1 December 15th 04 06:42 PM


All times are GMT +1. The time now is 11:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.