View Full Version : Macros to highlight form fields
francozola25
11-26-2008, 11:22 PM
Hello i was wondering if i could create a macro to hightlight form fields in my document. I currently have 500 documents form fields have been giving me nothing but problems. All i was looking for was to hightlight the text and back ground.
Many Thanks
Nelviticus
11-27-2008, 05:34 AM
If you're using a version of Office prior to 2007 you can highlight all form fields by clicking the 'Form Field Shading' button on the Forms toolbar (a little 'a' with a box around it). You don't need a macro.
If you're using Office 2007 that setting is now on the 'Developer' ribbon in the 'Controls' group, under the 'Legacy Tools' button.
Regards
francozola25
12-10-2008, 02:07 PM
The problem is my users do not have this option turned on all the time. Is there any other way that i could highlight fields in the document using the macro?
Nelviticus
12-11-2008, 02:31 AM
ActiveDocument.FormFields.Shaded = True
fumei
12-11-2008, 12:17 PM
If you want to actually highlight (as opposed to shading) then:
Dim oFF As Formfield
' you must turn OFF protection first, if it is on
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect Password:=""
End If
' use formfield object to change range highlight
For Each oFF In ActiveDocument.FormFields
oFF.Range.HighlightColorIndex = wdDarkYellow
Next
' re-protect
ActiveDocument.Protect wdAllowOnlyFormFields, _
NoRest:=True, Password:=""
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.