Validating checkbox values in MS Word

Joined
Jun 9, 2006
Messages
2
Reaction score
0
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
 
Joined
Jun 14, 2006
Messages
27
Reaction score
0
Hi

Don't know if your yes/no check boxs are in the same cell or adjacent.
Couldn't get the 'checking' of the box's by tabing past them on my machine
See attached word doc in zip file.

It's not completely bug free but may give you a start - it looks at it's on chk box value and then bars the adjacent cell chk box if checked, this works back or forth in the same line depending which one is selected first.

The macro is run on exit from the chk box.

Also a reset button added.

See how you get on

Regards

Zoddy
 

Attachments

  • chkbox.zip
    10.8 KB · Views: 69

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top