highlight all completed form fields

M

McWilfred

I need to highlight all the fields in a Word form that have been completed.
I'm a vb novice. . .
With assistance from some very helpful postings, I now have a functional
form that accomplishes my objectives. However, I'm sure there's a much better
way. I currently have one macro per field, each activated when exiting the
field.

How can I have a macro check all the fields for content and then highlight
those that are not blank? And, if I do that, I'm assuming that it would still
be best to reference that one macro when exiting each field?
 
D

Doug Robbins - Word MVP

Use:

Dim i As Long
With ActiveDocument
.Unprotect
For i = 1 To .FormFields.Count
With .FormFields(i)
If .Type = wdFieldFormTextInput And Trim(.Result) <> "" Then
.Range.Font.Color = wdColorGreen
End If
End With
Next i
.Protect wdAllowOnlyFormFields, noreset
End With


--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
 

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