Forms - dropdown - different font colors for each choice

B

Betsy

Is there any way to make the font color different for each choice within a
dropdown?

I have the following dropdown with four options:
TS (should be green font)
EC (should be blue font)
DN (should be orange font)
PA (should be red font)

when I try to change the color on one, it changes them all to that color.

Thanks
 
G

Graham Mayor

You would need a macro and you would probably need to remove the field
shading, but it should be possible. Assuming the dropdown field in question
is Dropdown1, run the following macro on exit from that field. As you tab
out of the field it will change colour appropriately.
http://www.gmayor.com/installing_macro.htm

Sub ColorDropDown()
Dim sText As String
Dim oFld As FormField
Set oFld = ActiveDocument.FormFields("Dropdown1")
sText = oFld.Result
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If
Select Case sText
Case Is = "TS" 'green font
oFld.Range.Font.Color = wdColorBrightGreen
Case Is = "EC" 'blue font
oFld.Range.Font.Color = wdColorBlue
Case Is = "DN" 'orange font
oFld.Range.Font.Color = wdColorLightOrange
Case Is = "PA" 'red font
oFld.Range.Font.Color = wdColorRed
End Select
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, _
NoReset:=True, _
Password:=""
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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