This is an unexpected but not entirely surprising result for a linked TOC.
By default, Word suppresses the normal Hyperlink style for hyperlinked TOCs
and cross-references, but it would appear that this field construction is
resulting in the style being applied as usual. Two possible workarounds:
1. Don't hyperlink the TOC (omit the \h switch). Since page numbers will
still by hyperlinked, however, they may be formatted.
2. If you don't have any other hyperlinks in the document that you want
formatted as blue and underlined, modify the Hyperlink (and Followed
Hyperlink) styles to be just Default Paragraph Font instead of Default
Paragraph Font + Underline, Font color: Blue/Violet.
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
Since the TOC field being used references a style, you'd have to check for
the presence of that style in the document. For the SET field, use the
following field:
{ SET errmessage { TOC \t "nonexistingstylename" \c } }
And then use the IF field I suggested in a previous message.
Stefan Blom
Microsoft Word MVP
in
message
The advantage of SET fields is that you can store the actual error message
displayed and, for example, display it using a REF field.
I'll have to continue my experiments with this tomorrow.
Stefan Blom
Microsoft Word MVP
in
message
I was trying it in Word 2003, where the error message is exactly as I
quoted
it, but I think the problem is that the IF field is basically
self-referential. I did think about bookmarking the TOC and REFing it, but
I
couldn't see how that could help. That is, if the only occurrence of the
TOC
is inside the IF field, then I don't see how it can work, but if there is
an
instance of the TOC field outside the IF field, then you're going to get
the
standard error message in addition to the custom one.
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USAhttp://word.mvps.org
- Mostrar texto de la cita -
Dear Suzanne and Stefan,
Thank you very much for your interest and quick answers. I (almost)
have the desired result. I mean, I have the desired customized message
when there are no entries in my TOC, and a TOC when there are some
entries. But the format of this TOC is not the same I got with the
original field.
The syntaxis I use now is
{ SET errmessage { TOC \h \z \t "My style" \c } }{ IF { REF
errmessage } = "
¡Error! No se encuentran elementos de tabla de ilustraciones." "My
customized text" "{ TOC \h \z \t "My style" \c }"}
(My computer and I speak Spanish, sorry for that)
I have had to include a carriage return in the standard error
message comparison with the REF field (I only discovered that after
some try and error). The " around the action in case the IF condition
is false seem to be optional.
The resulting TOC when there are entries is formatted in blue
underlined font, similar to a standard Hyperlink, instead of the
format of the original TOC in black font with some parts in bold and
so on.
Do you know if there is a way to control the format of this TOC? I
am going to read again the tutorials for TOCs by Suzanne and other
MVPs, but if you could point a particular link for this I would
appreciate it very much.
Thanks again for your help. It is a great luck for regular Word
users that people like you are helping us.