How can I create a macro that will highlight a dropdown menu sele.

T

toptan

I am using Office 2002 to create a vacation request form that uses the
dropdown menu. I would like to make the dropdown menu selection highlighted
if certain options are selected - so that those stand out from the rest of
the form. (For example if a letter is selected instead of a number I want
the letter answer to be hightlighted in Yellow) Is there a script or macro
that I can create and use on exit that will highlight if they select P
instead of 1 for example.
 
G

Greg

toptan,

Something like:

Sub HighLightFF()
Dim Drop As FormField

Set Drop = ActiveDocument.FormFields("DropDown1")

If Not (IsNumeric(Drop.Result)) Then
With ActiveDocument
.Sections(1).ProtectedForForms = False
Drop.Range.HighlightColorIndex = wdYellow
.Sections(1).ProtectedForForms = True
End With

Else: With ActiveDocument
.Sections(1).ProtectedForForms = False
Drop.Range.HighlightColorIndex = wdNoHighlight
.Sections(1).ProtectedForForms = True
End With

End If
End Sub
 

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