See
http://word.mvps.org/faqs/tblsfldsfms/ExclusiveFmFldChbxs.htm for the
principles involved in making check boxes exclusive, though personally I
would put the check boxes in a borderless table cell rather than in a frame
and change the code to that as follows.
The macro works on the premise that you have three check boxes named Red,
Blue and Green and a Text form field named Text1 which displays the result
text.
If you prefer to use the frame then change the line
For Each oField In Selection.Tables(1).Range.FormFields
to
For Each oField In Selection.Frames(1).Range.FormFields
Sub MakeCheckBoxesExclusive()
Dim oField As FormField
For Each oField In Selection.Tables(1).Range.FormFields
oField.CheckBox.Value = False
Next oField
Selection.FormFields(1).CheckBox.Value = True
If ActiveDocument.FormFields("Red").CheckBox.Value = True Then
ActiveDocument.FormFields("Text1").Result = "Account: 0001"
End If
If ActiveDocument.FormFields("Blue").CheckBox.Value = True Then
ActiveDocument.FormFields("Text1").Result = "Account: 0002"
End If
If ActiveDocument.FormFields("Green").CheckBox.Value = True Then
ActiveDocument.FormFields("Text1").Result = "Account: 0003"
End If
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Thanks Graham, let me attempt to give you a simplistic example of
what I'd lke to do...
I'd like to create a form that has three options on top with check
boxes, let's say Red, Blue & Green. I want to associate an account
number to each color (Red-0001, Blue-0002 & Green-0003). I want the
account number to appear in a field further down on the form.
Red [] Blue [X] Green []
Account: 0002
Is this possible?
Let me know if you need additional description.
Thanks in advanced!
Graham Mayor said:
You cannot create a formula from a check box, but it is easy enough
with vba to evaluate the result of a check box and insert stuff at
various locations based on that result - there are assorted examples
at
http://www.gmayor.com/SelectFile.htm and
http://www.gmayor.com/word_vba_examples.htm
If you need more help then you will have to explain what you require
in greater depth, in relation to the check boxes and how they relate
to the number (from where?) that you want to insert.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>