View Single Post
 
Old 11-25-2016, 03:37 AM
ramkumar.yoganathan ramkumar.yoganathan is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Nov 2016
Posts: 1
ramkumar.yoganathan is on a distinguished road
Default 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.
Attached Images
File Type: png form_field.PNG (1.4 KB, 20 views)
Reply With Quote