View Single Post
  #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.