I inherited a Word fill-in form. I was told the yes and no check boxes were
not working correctly. Instead of just using the yes, no check boxes, the
user wanted the person who fills out the form to only select yes or no. If
you select no, yes would be unchecked. I found a macro in the Macros dialog
box.
Sub MakeCheckBoxesExclusive()
'
' MakeCheckBoxesExclusive Macro
'
Dim oField As FormField
For Each oField In Selection.Frames(1).Range.FormFields
oField.CheckBox.Value = False
Next oField
Selection.FormFields(1).CheckBox.Value = True
End Sub
--------------
The problem is there are two fields prior to the yes, no check boxes and
when you select yes or no the prior two fields information is removed. The
form is setup in a table format. I'm not sure how to fix the VB code. I'm
assuming it's the macro causing the problem.
Stefan Blom - 28 Mar 2008 13:55 GMT
See http://word.mvps.org/faqs/tblsfldsfms/ExclusiveFmFldChbxs.htm.

Signature
Stefan Blom
Microsoft Word MVP
>I inherited a Word fill-in form. I was told the yes and no check boxes
>were
[quoted text clipped - 25 lines]
> I'm
> assuming it's the macro causing the problem.
Graham Mayor - 28 Mar 2008 14:24 GMT
A slightly more clunky method that works is to run a macro on exit from each
of the check box fields and set the other accordingly. The following assumes
two check box fields each with its own macro:
Sub is1Checked()
With ActiveDocument
If .FormFields("Check1").CheckBox.Value = True Then
.FormFields("Check2").CheckBox.Value = False
End If
If .FormFields("Check1").CheckBox.Value = False Then
.FormFields("Check2").CheckBox.Value = True
End If
End With
End Sub
Sub is2Checked()
With ActiveDocument
If .FormFields("Check2").CheckBox.Value = True Then
.FormFields("Check1").CheckBox.Value = False
End If
If .FormFields("Check2").CheckBox.Value = False Then
.FormFields("Check1").CheckBox.Value = True
End If
End With
End Sub

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> I inherited a Word fill-in form. I was told the yes and no check
> boxes were not working correctly. Instead of just using the yes, no
[quoted text clipped - 20 lines]
> removed. The form is setup in a table format. I'm not sure how to
> fix the VB code. I'm assuming it's the macro causing the problem.
macropod - 28 Mar 2008 23:04 GMT
Hi jlo,
If the user wants only Yes or No to be possible, why not use a dropdown in which 'Yes' and 'No' are the only options? Seems like a
lot less bother to me.
Cheers

Signature
macropod
[MVP - Microsoft Word]
-------------------------
>I inherited a Word fill-in form. I was told the yes and no check boxes were
> not working correctly. Instead of just using the yes, no check boxes, the
[quoted text clipped - 20 lines]
> form is setup in a table format. I'm not sure how to fix the VB code. I'm
> assuming it's the macro causing the problem.