How to get the MS Word Form Fields Check box associated text and their value using VBA?
How to get the MS word document checkbox form element associated text value. I am able to extract the value of the checkbox. I tried with bookmark and name properties and found that there is no value associated with bookmark filed of the checkbox. I got the following output. Any thoughts?
Sub Test()
Dim strCheckBoxName As String
Dim strCheckBoxValue As String
For i = 1 To ActiveDocument.FormFields.Count
If ActiveDocument.FormFields(i).CheckBox Then
strCheckBoxName = ActiveDocument.FormFields(i).Name
strCheckBoxValue = ActiveDocument.FormFields(i).CheckBox.Value
Debug.Print strCheckBoxName & " = " & strCheckBoxValue
End If
Next
End Sub
Output:
Check1 = True
Check1 = True
Check1 = True
Check1 = False
Check1 = False
Check1 = False
Solution looking for:
A = True
B = True
C = True
D = False
E = False
F = False
Thanks for your help.
|