Controls and Form Fields

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

I added a drop-down list to a document from the Developer tab by
inserting the control. However, when I run the code below, it does
not recognize it as a form field.

I must be missing something. . . . Please help. Alan

Sub CheckFormFields()
Dim aField As FormField
Debug.Print "There are " & ActiveDocument.FormFields.Count & _
" form fields in the active document"
For Each aField In ActiveDocument.FormFields
Debug.Print "Form Field Name: " & aField.Name
Debug.Print "Form Field Type: " & aField.Type
If aField.Type = wdFieldFormDropDown Then
Debug.Print "*** This is a drop-down list ***"
End If
Next aField
End Sub

Output: There are 0 form fields in the active document
 
See my reply in your other thread.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all
may benefit.
 
Back
Top