Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically highlight empty fields within Word

Status
Not open for further replies.

DanAtCDS

Technical User
May 20, 2003
22
US
I am looking for help in automating MS Word. Here is my situation:
There is an Access Database that houses all data used in a mail merge. However, I have roughly 200 forms that can be used in the mail merge depending on the situation at hand. What I'd like to do is have Word dynamically highlight any field that is left blank after the mail merge so to draw attention to it be its recipient.
Is there a way to do this? Can I set up code somewhere that can be used on all 200 forms without adding it to each one individually??
I'm new to working with code in Word so any help is greatly appreciated. (If it were an Access report I know the exact steps to take to highlight the null fields, does Word work the same way?)

Thank you!
 
Hi Dan,

Uou could embed your mergefields into IF statements like:
{IF{MERGEFIELD Item}<> "" {MERGEFIELD Item} "MISSING DATA"}
This will output the string "MISSING DATA" for any empty field. To make the "MISSING DATA" string stand out more, format it with whatever font attributes you'd like (eg Bold, Red with Yellow background).

BTW: You'll need to create the field braces for the IF statement via Ctrl-F9. The mergefield can simply be copied and pasted into the IF statement wherever needed.

Cheers
 
Macropod,
Thanks for the reply. Do you know if there is any way to apply the IF statement to all mergefields within a Word document. That is, with 200+ forms, adding an IF statement to all mergefields within all of the possible forms is not a time or money wise option. I'm envisioning [ponder] an iterative loop scenario, where I can run some code that will work it's way through all mergefileds and highlight them as they find null values?!?!? Can this be done?

Thank you for your time!
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top