J
Jack
Hello,
I have a Word doc with many textboxes and checkboxes that are part of the
fields collection. I'm having trouble with getting the value from the
checkboxes. The result property doesn't contain the value and I've tried
other ways of getting it, like referencing the associated formfield object
using the bookmarkid on the checkbox field. Two types of sample code is
below. Niether is correct because when iterating through the fields
collection, both lines of code will reference text boxes. I've tested this by
using the .select method so I could see which objects are being selected. If
it helps, the text boxes and check boxes are set inside Word tables.
------------------------------------------------------------------------------
Dim oField As Field
For Each oField In Me.Fields
If oField.Type = wdFieldFormCheckBox Then
If oField.Code.BookmarkID > 0 Then
' SAMPLE 1
MsgBox Me.FormFields(oField.Code.BookmarkID).CheckBox.Value
' SAMPLE 2
MsgBox
Me.FormFields(Me.Bookmarks(oField.Code.BookmarkID).Name).CheckBox.Value
End If
End If
Next
---------------------------------------------------------------------------------
Any help with what I'm doing wrong and the proper way of getting the
checkbox True or False value would be great and much appreciated.
Thanks
Jack
I have a Word doc with many textboxes and checkboxes that are part of the
fields collection. I'm having trouble with getting the value from the
checkboxes. The result property doesn't contain the value and I've tried
other ways of getting it, like referencing the associated formfield object
using the bookmarkid on the checkbox field. Two types of sample code is
below. Niether is correct because when iterating through the fields
collection, both lines of code will reference text boxes. I've tested this by
using the .select method so I could see which objects are being selected. If
it helps, the text boxes and check boxes are set inside Word tables.
------------------------------------------------------------------------------
Dim oField As Field
For Each oField In Me.Fields
If oField.Type = wdFieldFormCheckBox Then
If oField.Code.BookmarkID > 0 Then
' SAMPLE 1
MsgBox Me.FormFields(oField.Code.BookmarkID).CheckBox.Value
' SAMPLE 2
MsgBox
Me.FormFields(Me.Bookmarks(oField.Code.BookmarkID).Name).CheckBox.Value
End If
End If
Next
---------------------------------------------------------------------------------
Any help with what I'm doing wrong and the proper way of getting the
checkbox True or False value would be great and much appreciated.
Thanks
Jack