Hi,
I have a drop down box in word 2010 with the options "YES", "NO" and "N/A". I want to have conditional formatting for different color & font depending which is chose. e.g:
Yes = green
No = bold & red
N/A = gray
is there a way to do this?
Thanks in advance.
Last edited by omarq; 01-30-2012 at 06:45 AM.
Hi omarq,
You could do that via an 'on exit' macro attached to the formfield and coded as:
where 'Dropdown1' is the formfield's internal bookmark name.Sub ConditionalFormat() With ActiveDocument.FormFields("Dropdown1") .Range.Font.Bold = False If .Result = "Yes" Then .Range.Font.ColorIndex = wdGreen ElseIf .Result = "No" Then .Range.Font.ColorIndex = wdRed .Range.Font.Bold = True ElseIf .Result = "N/A" Then .Range.Font.ColorIndex = wdGray50 Else .Range.Font.ColorIndex = wdAuto End If End With End Sub
Last edited by macropod; 01-31-2012 at 05:23 AM. Reason: Corrected code for Dropdown with 3 options
Cheers,
Paul Edstein
[MS MVP - Word]
Thanks. I can't seem to get that working. Nothing seems to happen when i click and exit the form...
Is this for a dropdown formfield, or something else? If not for a dropdown formfield, then what?
Cheers,
Paul Edstein
[MS MVP - Word]
Ahh.. yes, sorry i was using a combobox. is it possible to do with that in word 2010?
thanks
You can't apply different colors to your different combobox entries - they must all be the same color. Document content can be any color.
Cheers,
Paul Edstein
[MS MVP - Word]
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks