I have a form where I have multiple Yes/No checkboxes next to
questions. The Yes/No checkboxes reside in a table and each checkbox
is in its own table cell.
What I want to do is not allow the user to check both checkboxes for
one question. I would like to do this in vba code. Here is what I have so far. The issue is that if the user tabs between Yes/No fields it checks the new field and unchecks the previous field.
Sub MakeCheckBoxesExclusive()
Dim oField As FormField
RowNum = Selection.Information(wdEndOfRangeRowNumber)
For Each oField In Selection.Tables(1).Rows(RowNum).Range.FormFields
oField.CheckBox.Value = False
Next oField
Selection.FormFields(1).CheckBox.Value = True
End Sub
questions. The Yes/No checkboxes reside in a table and each checkbox
is in its own table cell.
What I want to do is not allow the user to check both checkboxes for
one question. I would like to do this in vba code. Here is what I have so far. The issue is that if the user tabs between Yes/No fields it checks the new field and unchecks the previous field.
Sub MakeCheckBoxesExclusive()
Dim oField As FormField
RowNum = Selection.Information(wdEndOfRangeRowNumber)
For Each oField In Selection.Tables(1).Rows(RowNum).Range.FormFields
oField.CheckBox.Value = False
Next oField
Selection.FormFields(1).CheckBox.Value = True
End Sub