Conditional formatting of Mailmerge fields

T

THE Burg

I have some missing data in my database and want output documents to look
like printed forms with underlined blanks for these data. Have accomplished
this by putting series of underscores in the fields in the Excel database.
Would also like to highlight fields that need filled in to bring them to
document user's attention. I can highlight the field in the document, but
all results, even those that have values are highlighted. Is there a way to
highlight a field in the document ONLY when a certain condition exists -- say
the 2nd character in the field string is an underscore?
 
D

Doug Robbins - Word MVP

Rather than having the underscores in the data source, you could use the
following field construction

{ IF { MERGEFIELD fieldthatmightbeempty } <> "" { MERGEFIELD
fieldthatmightbeempty} { QUOTE "Please supply missing data" \*
Charformat } }

and format font to make the Q of QUOTE Red. If the field is empty, the
text "Please supply missing data" will be inserted in the document in Red

If you have the same number of underscores in each of the fields in the data
source, you could use

{ IF { MERGEFIELD fieldthatmightbeempty } <> "____" { MERGEFIELD
fieldthatmightbeempty} { QUOTE "____" \* Charformat } }

where the number of _ in the first ____ equals that in the data source and
then with the Q of QUOTE formatted as Red, the underscores in the merged
document would also be Red.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

macropod

Hi Burg,

Doug's given some good advice. To test whether the second character is an underscore::
{IF{MERGEFIELD Data}= "?_*" {QUOTE "Missing data" \* Charformat} {MERGEFIELD Data}}
with the 'Q' in 'QUOTE' formatted per your conditional format.
 
T

THE Burg

Thanks to both of you -- that took care of it!

macropod said:
Hi Burg,

Doug's given some good advice. To test whether the second character is an underscore::
{IF{MERGEFIELD Data}= "?_*" {QUOTE "Missing data" \* Charformat} {MERGEFIELD Data}}
with the 'Q' in 'QUOTE' formatted per your conditional format.

--
Cheers
macropod
[MVP - Microsoft Word]


THE Burg said:
I have some missing data in my database and want output documents to look
like printed forms with underlined blanks for these data. Have accomplished
this by putting series of underscores in the fields in the Excel database.
Would also like to highlight fields that need filled in to bring them to
document user's attention. I can highlight the field in the document, but
all results, even those that have values are highlighted. Is there a way to
highlight a field in the document ONLY when a certain condition exists -- say
the 2nd character in the field string is an underscore?
 

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