#1   Report Post  
Posted to microsoft.public.word.docmanagement
ODog Trying NewTricks ODog Trying NewTricks is offline
external usenet poster
 
Posts: 1
Default Bookmark and REF

I inserted an ask statement with a switch to default to blank if no answer is
given, then I used the REF and again used a switch to default to blank if no
source is found. I thought this would work, but it doesn't. The program still
returns !Error. Reference Source Not Found. Does anyone have a suggestion on
how I can reference a blank (instead of the previous response) if no response
is given?

code: {ask created "Enter Date Created." \d ""}{ref created \d ""}
{ask approved "Enter Date Approved." \d ""}{ref approved
\d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Bookmark and REF

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank if no
answer is given, then I used the REF and again used a switch to
default to blank if no source is found. I thought this would work,
but it doesn't. The program still returns !Error. Reference Source
Not Found. Does anyone have a suggestion on how I can reference a
blank (instead of the previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.


If you can live with a single space for the value of the ref field when the
ask field isn't answered, you can put a space character between the quotes
in the \d switch of the ask field. (You can then remove the \d switch from
the ref field, because it'll never have any effect.)

If you need to eliminate the space (maybe to make other things on the same
line stay put), it's possible but more complicated. You have to replace the
ref field with this:

{if "{ref created}" = "Error! Reference source not found." "" {ref created}}

and similarly for the ref approved field. This compares the result of the
ref field to the possible error message; if they're equal, the result of the
if field is an empty string, otherwise it's the value of the ref field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
ODog Trying NewTricks[_2_] ODog Trying NewTricks[_2_] is offline
external usenet poster
 
Posts: 6
Default Bookmark and REF

Fabulous! Thank you much.

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank if no
answer is given, then I used the REF and again used a switch to
default to blank if no source is found. I thought this would work,
but it doesn't. The program still returns !Error. Reference Source
Not Found. Does anyone have a suggestion on how I can reference a
blank (instead of the previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.


If you can live with a single space for the value of the ref field when the
ask field isn't answered, you can put a space character between the quotes
in the \d switch of the ask field. (You can then remove the \d switch from
the ref field, because it'll never have any effect.)

If you need to eliminate the space (maybe to make other things on the same
line stay put), it's possible but more complicated. You have to replace the
ref field with this:

{if "{ref created}" = "Error! Reference source not found." "" {ref created}}

and similarly for the ref approved field. This compares the result of the
ref field to the possible error message; if they're equal, the result of the
if field is an empty string, otherwise it's the value of the ref field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Zadok @ Port of Seattle Zadok @ Port of Seattle is offline
external usenet poster
 
Posts: 6
Default Bookmark and REF

Jay
This is oh so close to what I'm looking for. I am doing a StyleRef in the
footer of my document, showing the user where they are in a huge numbered
list. Some of the later pages don't have any of the 'Numbered List" style in
use and so the formula just returns the last known instance of that style,
even if it was pages ago. Is it possible to get a blank if there is no use of
that style on my certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank if no
answer is given, then I used the REF and again used a switch to
default to blank if no source is found. I thought this would work,
but it doesn't. The program still returns !Error. Reference Source
Not Found. Does anyone have a suggestion on how I can reference a
blank (instead of the previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.


If you can live with a single space for the value of the ref field when the
ask field isn't answered, you can put a space character between the quotes
in the \d switch of the ask field. (You can then remove the \d switch from
the ref field, because it'll never have any effect.)

If you need to eliminate the space (maybe to make other things on the same
line stay put), it's possible but more complicated. You have to replace the
ref field with this:

{if "{ref created}" = "Error! Reference source not found." "" {ref created}}

and similarly for the ref approved field. This compares the result of the
ref field to the possible error message; if they're equal, the result of the
if field is an empty string, otherwise it's the value of the ref field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.



  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Bookmark and REF

It doesn't appear that you can do that. The Help topic on the StyleRef field
lists all the switches that control where it locates the style and what
results it shows. There isn't any switch that shows what page the style
appears on, which is what you'd need in order to suppress the field result.

Possibly you could put an empty paragraph of the Numbered List style, marked
to skip numbering, on the page after the most recent "real" numbered
paragraph. That would be very fragile and hard to maintain, though, and it
might mess up the numbering order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Zadok @ Port of Seattle wrote:
Jay
This is oh so close to what I'm looking for. I am doing a StyleRef in
the footer of my document, showing the user where they are in a huge
numbered list. Some of the later pages don't have any of the
'Numbered List" style in use and so the formula just returns the last
known instance of that style, even if it was pages ago. Is it
possible to get a blank if there is no use of that style on my
certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank if no
answer is given, then I used the REF and again used a switch to
default to blank if no source is found. I thought this would work,
but it doesn't. The program still returns !Error. Reference Source
Not Found. Does anyone have a suggestion on how I can reference a
blank (instead of the previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.


If you can live with a single space for the value of the ref field
when the ask field isn't answered, you can put a space character
between the quotes in the \d switch of the ask field. (You can then
remove the \d switch from the ref field, because it'll never have
any effect.)

If you need to eliminate the space (maybe to make other things on
the same line stay put), it's possible but more complicated. You
have to replace the ref field with this:

{if "{ref created}" = "Error! Reference source not found." "" {ref
created}}

and similarly for the ref approved field. This compares the result
of the ref field to the possible error message; if they're equal,
the result of the if field is an empty string, otherwise it's the
value of the ref field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Zadok @ Port of Seattle Zadok @ Port of Seattle is offline
external usenet poster
 
Posts: 6
Default Bookmark and REF

Jay,
That works great, now I have a '0' in the reference; can I switch that off?


"Jay Freedman" wrote:

It doesn't appear that you can do that. The Help topic on the StyleRef field
lists all the switches that control where it locates the style and what
results it shows. There isn't any switch that shows what page the style
appears on, which is what you'd need in order to suppress the field result.

Possibly you could put an empty paragraph of the Numbered List style, marked
to skip numbering, on the page after the most recent "real" numbered
paragraph. That would be very fragile and hard to maintain, though, and it
might mess up the numbering order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Zadok @ Port of Seattle wrote:
Jay
This is oh so close to what I'm looking for. I am doing a StyleRef in
the footer of my document, showing the user where they are in a huge
numbered list. Some of the later pages don't have any of the
'Numbered List" style in use and so the formula just returns the last
known instance of that style, even if it was pages ago. Is it
possible to get a blank if there is no use of that style on my
certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank if no
answer is given, then I used the REF and again used a switch to
default to blank if no source is found. I thought this would work,
but it doesn't. The program still returns !Error. Reference Source
Not Found. Does anyone have a suggestion on how I can reference a
blank (instead of the previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

If you can live with a single space for the value of the ref field
when the ask field isn't answered, you can put a space character
between the quotes in the \d switch of the ask field. (You can then
remove the \d switch from the ref field, because it'll never have
any effect.)

If you need to eliminate the space (maybe to make other things on
the same line stay put), it's possible but more complicated. You
have to replace the ref field with this:

{if "{ref created}" = "Error! Reference source not found." "" {ref
created}}

and similarly for the ref approved field. This compares the result
of the ref field to the possible error message; if they're equal,
the result of the if field is an empty string, otherwise it's the
value of the ref field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.




  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Bookmark and REF

I don't understand where you're getting a '0' from. If I have an empty
paragraph of the referenced style (the numbering is turned off, and nothing
appears but the ¶ symbol when nonprinting characters are shown), then the
StyleRef field in the footer doesn't show anything.

Still, there is a technique to work around the '0' if you can't get rid of
it, similar to the one that started this thread. You need nested fields (use
Ctrl+F9 to insert each pair of field braces):

{ If {StyleRef MyStyle} = "0" "" {StyleRef MyStyle} }

This says if the result of the StyleRef field is the character "0", then
display nothing; otherwise display the result of the StyleRef field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Zadok @ Port of Seattle wrote:
Jay,
That works great, now I have a '0' in the reference; can I switch
that off?


"Jay Freedman" wrote:

It doesn't appear that you can do that. The Help topic on the
StyleRef field lists all the switches that control where it locates
the style and what results it shows. There isn't any switch that
shows what page the style appears on, which is what you'd need in
order to suppress the field result.

Possibly you could put an empty paragraph of the Numbered List
style, marked to skip numbering, on the page after the most recent
"real" numbered paragraph. That would be very fragile and hard to
maintain, though, and it might mess up the numbering order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay
This is oh so close to what I'm looking for. I am doing a StyleRef
in the footer of my document, showing the user where they are in a
huge numbered list. Some of the later pages don't have any of the
'Numbered List" style in use and so the formula just returns the
last known instance of that style, even if it was pages ago. Is it
possible to get a blank if there is no use of that style on my
certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank if
no answer is given, then I used the REF and again used a switch to
default to blank if no source is found. I thought this would work,
but it doesn't. The program still returns !Error. Reference Source
Not Found. Does anyone have a suggestion on how I can reference a
blank (instead of the previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

If you can live with a single space for the value of the ref field
when the ask field isn't answered, you can put a space character
between the quotes in the \d switch of the ask field. (You can then
remove the \d switch from the ref field, because it'll never have
any effect.)

If you need to eliminate the space (maybe to make other things on
the same line stay put), it's possible but more complicated. You
have to replace the ref field with this:

{if "{ref created}" = "Error! Reference source not found." "" {ref
created}}

and similarly for the ref approved field. This compares the result
of the ref field to the possible error message; if they're equal,
the result of the if field is an empty string, otherwise it's the
value of the ref field.



  #8   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default Bookmark and REF

A zero result indicates that the STYLEREF field is trying to reference
the (non-existing) number of an un-numbered paragraph.

--
Stefan Blom
Microsoft Word MVP


"Jay Freedman" wrote in message
...
I don't understand where you're getting a '0' from. If I have an empty
paragraph of the referenced style (the numbering is turned off, and

nothing
appears but the ¶ symbol when nonprinting characters are shown), then

the
StyleRef field in the footer doesn't show anything.

Still, there is a technique to work around the '0' if you can't get

rid of
it, similar to the one that started this thread. You need nested

fields (use
Ctrl+F9 to insert each pair of field braces):

{ If {StyleRef MyStyle} = "0" "" {StyleRef MyStyle} }

This says if the result of the StyleRef field is the character "0",

then
display nothing; otherwise display the result of the StyleRef field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the

newsgroup so
all may benefit.

Zadok @ Port of Seattle wrote:
Jay,
That works great, now I have a '0' in the reference; can I switch
that off?


"Jay Freedman" wrote:

It doesn't appear that you can do that. The Help topic on the
StyleRef field lists all the switches that control where it locates
the style and what results it shows. There isn't any switch that
shows what page the style appears on, which is what you'd need in
order to suppress the field result.

Possibly you could put an empty paragraph of the Numbered List
style, marked to skip numbering, on the page after the most recent
"real" numbered paragraph. That would be very fragile and hard to
maintain, though, and it might mess up the numbering order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay
This is oh so close to what I'm looking for. I am doing a StyleRef
in the footer of my document, showing the user where they are in a
huge numbered list. Some of the later pages don't have any of the
'Numbered List" style in use and so the formula just returns the
last known instance of that style, even if it was pages ago. Is it
possible to get a blank if there is no use of that style on my
certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank if
no answer is given, then I used the REF and again used a switch

to
default to blank if no source is found. I thought this would

work,
but it doesn't. The program still returns !Error. Reference

Source
Not Found. Does anyone have a suggestion on how I can reference

a
blank (instead of the previous response) if no response is

given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

If you can live with a single space for the value of the ref

field
when the ask field isn't answered, you can put a space character
between the quotes in the \d switch of the ask field. (You can

then
remove the \d switch from the ref field, because it'll never have
any effect.)

If you need to eliminate the space (maybe to make other things on
the same line stay put), it's possible but more complicated. You
have to replace the ref field with this:

{if "{ref created}" = "Error! Reference source not found." ""

{ref
created}}

and similarly for the ref approved field. This compares the

result
of the ref field to the possible error message; if they're equal,
the result of the if field is an empty string, otherwise it's the
value of the ref field.







  #9   Report Post  
Posted to microsoft.public.word.docmanagement
Zadok @ Port of Seattle Zadok @ Port of Seattle is offline
external usenet poster
 
Posts: 6
Default Bookmark and REF

Jay,
Many thanks for the help with this, my doc is nearly perfect. This is my
first IF statement in a Reference. One last tweak, is it possible to return
"" if there is no reference to MyStyle? I get this error otherwise:

Error! No text of specified style in document.

Zadok


"Jay Freedman" wrote:

I don't understand where you're getting a '0' from. If I have an empty
paragraph of the referenced style (the numbering is turned off, and nothing
appears but the ¶ symbol when nonprinting characters are shown), then the
StyleRef field in the footer doesn't show anything.

Still, there is a technique to work around the '0' if you can't get rid of
it, similar to the one that started this thread. You need nested fields (use
Ctrl+F9 to insert each pair of field braces):

{ If {StyleRef MyStyle} = "0" "" {StyleRef MyStyle} }

This says if the result of the StyleRef field is the character "0", then
display nothing; otherwise display the result of the StyleRef field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Zadok @ Port of Seattle wrote:
Jay,
That works great, now I have a '0' in the reference; can I switch
that off?


"Jay Freedman" wrote:

It doesn't appear that you can do that. The Help topic on the
StyleRef field lists all the switches that control where it locates
the style and what results it shows. There isn't any switch that
shows what page the style appears on, which is what you'd need in
order to suppress the field result.

Possibly you could put an empty paragraph of the Numbered List
style, marked to skip numbering, on the page after the most recent
"real" numbered paragraph. That would be very fragile and hard to
maintain, though, and it might mess up the numbering order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay
This is oh so close to what I'm looking for. I am doing a StyleRef
in the footer of my document, showing the user where they are in a
huge numbered list. Some of the later pages don't have any of the
'Numbered List" style in use and so the formula just returns the
last known instance of that style, even if it was pages ago. Is it
possible to get a blank if there is no use of that style on my
certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank if
no answer is given, then I used the REF and again used a switch to
default to blank if no source is found. I thought this would work,
but it doesn't. The program still returns !Error. Reference Source
Not Found. Does anyone have a suggestion on how I can reference a
blank (instead of the previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

If you can live with a single space for the value of the ref field
when the ask field isn't answered, you can put a space character
between the quotes in the \d switch of the ask field. (You can then
remove the \d switch from the ref field, because it'll never have
any effect.)

If you need to eliminate the space (maybe to make other things on
the same line stay put), it's possible but more complicated. You
have to replace the ref field with this:

{if "{ref created}" = "Error! Reference source not found." "" {ref
created}}

and similarly for the ref approved field. This compares the result
of the ref field to the possible error message; if they're equal,
the result of the if field is an empty string, otherwise it's the
value of the ref field.




  #10   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Bookmark and REF

I'll refer you again to the technique in the post at the very bottom
of this thread... Write an IF field that compares the value of the
StyleRef field to the error message you quoted, and displays an empty
string if they're equal, or the value of the StyleRef otherwise. Embed
that entire IF field within the IF field of my most recent reply, in
place of the second {StyleRef MyStyle} field.

It gets long and complicated, but it works.

On Tue, 15 May 2007 14:36:01 -0700, Zadok @ Port of Seattle
wrote:

Jay,
Many thanks for the help with this, my doc is nearly perfect. This is my
first IF statement in a Reference. One last tweak, is it possible to return
"" if there is no reference to MyStyle? I get this error otherwise:

Error! No text of specified style in document.

Zadok


"Jay Freedman" wrote:

I don't understand where you're getting a '0' from. If I have an empty
paragraph of the referenced style (the numbering is turned off, and nothing
appears but the ¶ symbol when nonprinting characters are shown), then the
StyleRef field in the footer doesn't show anything.

Still, there is a technique to work around the '0' if you can't get rid of
it, similar to the one that started this thread. You need nested fields (use
Ctrl+F9 to insert each pair of field braces):

{ If {StyleRef MyStyle} = "0" "" {StyleRef MyStyle} }

This says if the result of the StyleRef field is the character "0", then
display nothing; otherwise display the result of the StyleRef field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Zadok @ Port of Seattle wrote:
Jay,
That works great, now I have a '0' in the reference; can I switch
that off?


"Jay Freedman" wrote:

It doesn't appear that you can do that. The Help topic on the
StyleRef field lists all the switches that control where it locates
the style and what results it shows. There isn't any switch that
shows what page the style appears on, which is what you'd need in
order to suppress the field result.

Possibly you could put an empty paragraph of the Numbered List
style, marked to skip numbering, on the page after the most recent
"real" numbered paragraph. That would be very fragile and hard to
maintain, though, and it might mess up the numbering order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay
This is oh so close to what I'm looking for. I am doing a StyleRef
in the footer of my document, showing the user where they are in a
huge numbered list. Some of the later pages don't have any of the
'Numbered List" style in use and so the formula just returns the
last known instance of that style, even if it was pages ago. Is it
possible to get a blank if there is no use of that style on my
certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank if
no answer is given, then I used the REF and again used a switch to
default to blank if no source is found. I thought this would work,
but it doesn't. The program still returns !Error. Reference Source
Not Found. Does anyone have a suggestion on how I can reference a
blank (instead of the previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

If you can live with a single space for the value of the ref field
when the ask field isn't answered, you can put a space character
between the quotes in the \d switch of the ask field. (You can then
remove the \d switch from the ref field, because it'll never have
any effect.)

If you need to eliminate the space (maybe to make other things on
the same line stay put), it's possible but more complicated. You
have to replace the ref field with this:

{if "{ref created}" = "Error! Reference source not found." "" {ref
created}}

and similarly for the ref approved field. This compares the result
of the ref field to the possible error message; if they're equal,
the result of the if field is an empty string, otherwise it's the
value of the ref field.





--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.


  #11   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Bookmark and REF

You don't even need the full error message

{ IF{ STYLEREF "MyStyle" } "Error!*" "{ STYLEREF "MyStyle" }" }

will do the trick


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Jay Freedman wrote:
I'll refer you again to the technique in the post at the very bottom
of this thread... Write an IF field that compares the value of the
StyleRef field to the error message you quoted, and displays an empty
string if they're equal, or the value of the StyleRef otherwise. Embed
that entire IF field within the IF field of my most recent reply, in
place of the second {StyleRef MyStyle} field.

It gets long and complicated, but it works.

On Tue, 15 May 2007 14:36:01 -0700, Zadok @ Port of Seattle
wrote:

Jay,
Many thanks for the help with this, my doc is nearly perfect. This
is my first IF statement in a Reference. One last tweak, is it
possible to return "" if there is no reference to MyStyle? I get
this error otherwise:

Error! No text of specified style in document.

Zadok


"Jay Freedman" wrote:

I don't understand where you're getting a '0' from. If I have an
empty paragraph of the referenced style (the numbering is turned
off, and nothing appears but the ¶ symbol when nonprinting
characters are shown), then the StyleRef field in the footer
doesn't show anything.

Still, there is a technique to work around the '0' if you can't get
rid of it, similar to the one that started this thread. You need
nested fields (use Ctrl+F9 to insert each pair of field braces):

{ If {StyleRef MyStyle} = "0" "" {StyleRef MyStyle} }

This says if the result of the StyleRef field is the character "0",
then display nothing; otherwise display the result of the StyleRef
field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay,
That works great, now I have a '0' in the reference; can I switch
that off?


"Jay Freedman" wrote:

It doesn't appear that you can do that. The Help topic on the
StyleRef field lists all the switches that control where it
locates the style and what results it shows. There isn't any
switch that shows what page the style appears on, which is what
you'd need in order to suppress the field result.

Possibly you could put an empty paragraph of the Numbered List
style, marked to skip numbering, on the page after the most recent
"real" numbered paragraph. That would be very fragile and hard to
maintain, though, and it might mess up the numbering order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay
This is oh so close to what I'm looking for. I am doing a
StyleRef in the footer of my document, showing the user where
they are in a huge numbered list. Some of the later pages don't
have any of the 'Numbered List" style in use and so the formula
just returns the last known instance of that style, even if it
was pages ago. Is it possible to get a blank if there is no use
of that style on my certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank
if no answer is given, then I used the REF and again used a
switch to default to blank if no source is found. I thought
this would work, but it doesn't. The program still returns
!Error. Reference Source Not Found. Does anyone have a
suggestion on how I can reference a blank (instead of the
previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

If you can live with a single space for the value of the ref
field when the ask field isn't answered, you can put a space
character between the quotes in the \d switch of the ask field.
(You can then remove the \d switch from the ref field, because
it'll never have any effect.)

If you need to eliminate the space (maybe to make other things
on the same line stay put), it's possible but more complicated.
You have to replace the ref field with this:

{if "{ref created}" = "Error! Reference source not found." ""
{ref created}}

and similarly for the ref approved field. This compares the
result of the ref field to the possible error message; if
they're equal, the result of the if field is an empty string,
otherwise it's the value of the ref field.



  #12   Report Post  
Posted to microsoft.public.word.docmanagement
Zadok @ Port of Seattle Zadok @ Port of Seattle is offline
external usenet poster
 
Posts: 6
Default Bookmark and REF

Graham,
Wow that is pretty tight. Is there any way to do an OR statement? I'd like
to supress the STYLEREF if there is an Error or a "0" value.


"Graham Mayor" wrote:

You don't even need the full error message

{ IF{ STYLEREF "MyStyle" } "Error!*" "{ STYLEREF "MyStyle" }" }

will do the trick


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Jay Freedman wrote:
I'll refer you again to the technique in the post at the very bottom
of this thread... Write an IF field that compares the value of the
StyleRef field to the error message you quoted, and displays an empty
string if they're equal, or the value of the StyleRef otherwise. Embed
that entire IF field within the IF field of my most recent reply, in
place of the second {StyleRef MyStyle} field.

It gets long and complicated, but it works.

On Tue, 15 May 2007 14:36:01 -0700, Zadok @ Port of Seattle
wrote:

Jay,
Many thanks for the help with this, my doc is nearly perfect. This
is my first IF statement in a Reference. One last tweak, is it
possible to return "" if there is no reference to MyStyle? I get
this error otherwise:

Error! No text of specified style in document.

Zadok


"Jay Freedman" wrote:

I don't understand where you're getting a '0' from. If I have an
empty paragraph of the referenced style (the numbering is turned
off, and nothing appears but the ¶ symbol when nonprinting
characters are shown), then the StyleRef field in the footer
doesn't show anything.

Still, there is a technique to work around the '0' if you can't get
rid of it, similar to the one that started this thread. You need
nested fields (use Ctrl+F9 to insert each pair of field braces):

{ If {StyleRef MyStyle} = "0" "" {StyleRef MyStyle} }

This says if the result of the StyleRef field is the character "0",
then display nothing; otherwise display the result of the StyleRef
field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay,
That works great, now I have a '0' in the reference; can I switch
that off?


"Jay Freedman" wrote:

It doesn't appear that you can do that. The Help topic on the
StyleRef field lists all the switches that control where it
locates the style and what results it shows. There isn't any
switch that shows what page the style appears on, which is what
you'd need in order to suppress the field result.

Possibly you could put an empty paragraph of the Numbered List
style, marked to skip numbering, on the page after the most recent
"real" numbered paragraph. That would be very fragile and hard to
maintain, though, and it might mess up the numbering order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay
This is oh so close to what I'm looking for. I am doing a
StyleRef in the footer of my document, showing the user where
they are in a huge numbered list. Some of the later pages don't
have any of the 'Numbered List" style in use and so the formula
just returns the last known instance of that style, even if it
was pages ago. Is it possible to get a blank if there is no use
of that style on my certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank
if no answer is given, then I used the REF and again used a
switch to default to blank if no source is found. I thought
this would work, but it doesn't. The program still returns
!Error. Reference Source Not Found. Does anyone have a
suggestion on how I can reference a blank (instead of the
previous response) if no response is given?

code: {ask created "Enter Date Created." \d ""}{ref
created \d ""} {ask approved "Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

If you can live with a single space for the value of the ref
field when the ask field isn't answered, you can put a space
character between the quotes in the \d switch of the ask field.
(You can then remove the \d switch from the ref field, because
it'll never have any effect.)

If you need to eliminate the space (maybe to make other things
on the same line stay put), it's possible but more complicated.
You have to replace the ref field with this:

{if "{ref created}" = "Error! Reference source not found." ""
{ref created}}

and similarly for the ref approved field. This compares the
result of the ref field to the possible error message; if
they're equal, the result of the if field is an empty string,
otherwise it's the value of the ref field.




  #13   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Bookmark and REF

{ IF{ STYLEREF "MyStyle" } "Error!*" " { IF{ STYLEREF "MyStyle" } 0
"{ STYLEREF "MyStyle" }" }" }

should do the trick
--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Zadok @ Port of Seattle wrote:
Graham,
Wow that is pretty tight. Is there any way to do an OR statement? I'd
like to supress the STYLEREF if there is an Error or a "0" value.


"Graham Mayor" wrote:

You don't even need the full error message

{ IF{ STYLEREF "MyStyle" } "Error!*" "{ STYLEREF "MyStyle" }" }

will do the trick


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Jay Freedman wrote:
I'll refer you again to the technique in the post at the very bottom
of this thread... Write an IF field that compares the value of the
StyleRef field to the error message you quoted, and displays an
empty string if they're equal, or the value of the StyleRef
otherwise. Embed that entire IF field within the IF field of my
most recent reply, in place of the second {StyleRef MyStyle} field.

It gets long and complicated, but it works.

On Tue, 15 May 2007 14:36:01 -0700, Zadok @ Port of Seattle
wrote:

Jay,
Many thanks for the help with this, my doc is nearly perfect. This
is my first IF statement in a Reference. One last tweak, is it
possible to return "" if there is no reference to MyStyle? I get
this error otherwise:

Error! No text of specified style in document.

Zadok


"Jay Freedman" wrote:

I don't understand where you're getting a '0' from. If I have an
empty paragraph of the referenced style (the numbering is turned
off, and nothing appears but the ¶ symbol when nonprinting
characters are shown), then the StyleRef field in the footer
doesn't show anything.

Still, there is a technique to work around the '0' if you can't
get rid of it, similar to the one that started this thread. You
need nested fields (use Ctrl+F9 to insert each pair of field
braces):

{ If {StyleRef MyStyle} = "0" "" {StyleRef MyStyle} }

This says if the result of the StyleRef field is the character
"0", then display nothing; otherwise display the result of the
StyleRef field.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay,
That works great, now I have a '0' in the reference; can I switch
that off?


"Jay Freedman" wrote:

It doesn't appear that you can do that. The Help topic on the
StyleRef field lists all the switches that control where it
locates the style and what results it shows. There isn't any
switch that shows what page the style appears on, which is what
you'd need in order to suppress the field result.

Possibly you could put an empty paragraph of the Numbered List
style, marked to skip numbering, on the page after the most
recent "real" numbered paragraph. That would be very fragile
and hard to maintain, though, and it might mess up the
numbering order.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

Zadok @ Port of Seattle wrote:
Jay
This is oh so close to what I'm looking for. I am doing a
StyleRef in the footer of my document, showing the user where
they are in a huge numbered list. Some of the later pages don't
have any of the 'Numbered List" style in use and so the formula
just returns the last known instance of that style, even if it
was pages ago. Is it possible to get a blank if there is no use
of that style on my certain page?

Zadok

"Jay Freedman" wrote:

ODog Trying NewTricks wrote:
I inserted an ask statement with a switch to default to blank
if no answer is given, then I used the REF and again used a
switch to default to blank if no source is found. I thought
this would work, but it doesn't. The program still returns
!Error. Reference Source Not Found. Does anyone have a
suggestion on how I can reference a blank (instead of the
previous response) if no response is given?

code: {ask created "Enter Date Created." \d
""}{ref created \d ""} {ask approved
"Enter Date
Approved." \d ""}{ref approved \d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

If you can live with a single space for the value of the ref
field when the ask field isn't answered, you can put a space
character between the quotes in the \d switch of the ask
field. (You can then remove the \d switch from the ref field,
because it'll never have any effect.)

If you need to eliminate the space (maybe to make other things
on the same line stay put), it's possible but more
complicated. You have to replace the ref field with this:

{if "{ref created}" = "Error! Reference source not found." ""
{ref created}}

and similarly for the ref approved field. This compares the
result of the ref field to the possible error message; if
they're equal, the result of the if field is an empty string,
otherwise it's the value of the ref field.



  #14   Report Post  
Posted to microsoft.public.word.docmanagement
shila shila is offline
external usenet poster
 
Posts: 2
Default Bookmark and REF



"ODog Trying NewTricks" wrote:

I inserted an ask statement with a switch to default to blank if no answer is
given, then I used the REF and again used a switch to default to blank if no
source is found. I thought this would work, but it doesn't. The program still
returns !Error. Reference Source Not Found. Does anyone have a suggestion on
how I can reference a blank (instead of the previous response) if no response
is given?

code: {ask created "Enter Date Created." \d ""}{ref created \d ""}
{ask approved "Enter Date Approved." \d ""}{ref approved
\d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

  #15   Report Post  
Posted to microsoft.public.word.docmanagement
shila shila is offline
external usenet poster
 
Posts: 2
Default Bookmark and REF



"ODog Trying NewTricks" wrote:

I inserted an ask statement with a switch to default to blank if no answer is
given, then I used the REF and again used a switch to default to blank if no
source is found. I thought this would work, but it doesn't. The program still
returns !Error. Reference Source Not Found. Does anyone have a suggestion on
how I can reference a blank (instead of the previous response) if no response
is given?

code: {ask created "Enter Date Created." \d ""}{ref created \d ""}
{ask approved "Enter Date Approved." \d ""}{ref approved
\d "")

results: Created on: April 4, 2007
Approved on: Error! Reference source not found.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bookmark Alan T New Users 5 January 31st 07 10:09 AM
Bookmark texbox Daniel Microsoft Word Help 1 November 22nd 06 11:10 PM
My noteref to valid bookmark says "Error! Bookmark not defined."? jchilders_98 Microsoft Word Help 3 October 5th 06 02:23 PM
The Insert Bookmark box shouldnt vanish after adding a bookmark. RogerKni Microsoft Word Help 4 September 26th 06 03:13 PM
Bookmark Afzal Khan Microsoft Word Help 1 October 21st 05 12:47 PM


All times are GMT +1. The time now is 01:49 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"