auto-format all form fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have twenty or so documents where I want all the form field font styles to
be the same. What can I do so that, when I create a form field, its font is
automatically formatted with my desired style?
 
PS - I have a style already created, called "Form Field." I just want to know
how to get form fields to use that by default so I don't have to apply the
formatting manually to each field in all the documents.

Thanks,

mike
 
Hi Mike,

Since the documents already exist, you should use the Edit > Replace
dialog to apply the style to the fields. If the fields are not the
only text in the paragraphs that contain them, the style should be a
character style rather than a paragraph style.

Open one document and unprotect it. Press Alt+F9 to display field
codes. Open the Edit > Replace dialog and click the More button.

In the Find What box, enter

^d FORMTEXT

In the Replace With box, enter

^&

which is the code for "the text that was found". Now click the Format
button and select Style; in the next dialog, select your Form Field
style and click OK.

Back in the Replace dialog, click the Replace All button. Close the
dialog, press Alt+F9 again to collapse the fields, protect the
document, and save. Repeat for the other documents.

If you need to do this with a macro that will process all the
documents at one go, see
http://word.mvps.org/FAQs/MacrosVBA/BatchFR.htm.

For future documents, you can automate the insert-and-format procedure
by inserting this macro in your template and replacing the text field
button on the Forms toolbar with a button that runs the macro.

Public Sub InsertTextFormField()
Dim oRg As Range

On Error Resume Next
Set oRg = Selection.Range
ActiveDocument.FormFields.Add Range:=oRg, _
Type:=wdFieldFormTextInput
oRg.MoveEnd unit:=wdWord, Count:=1
oRg.Style = ActiveDocument.Styles("Form Field")
Set oRg = Nothing
End Sub
 
Back
Top