Convert Mail merge fields to fillable form fields in Word

1.6k views Asked by At

I have a word template ready with mail merge fields.

Is there a easy way to convert them into fillable form fields?

In the end I want to create a fillable pdf form.

1

There are 1 answers

0
ForEachLoop On

If it's a simple legacy field:

Public Sub ReplaceMergeFields()
    On Error GoTo MyErrorHandler

    Dim sourceDocument As Document
    Set sourceDocument = ActiveDocument

    Dim myMergeField As Field
    Dim i As Long
    For i = sourceDocument.Fields.Count To 1 Step -1
        Set myMergeField = sourceDocument.Fields(i)

        myMergeField.Select
        If myMergeField.Type = wdFieldMergeField Then
            Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormTextInput
        End If

        DoEvents
    Next

    Exit Sub

MyErrorHandler:
    MsgBox "ReplaceMergeFields" & vbCrLf & vbCrLf & "Err = " & Err.Number & vbCrLf & "Description: " & Err.Description
End Sub