conditional checkbox??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to use some checkboxes in a conditional if statement. I don't
know what to put in place for Expression2. I want it to be the value when
the box is checked, but don't know what that is.

Any ideas?
 
I don't know of any way to evaluate the state of a formfield check box in Word.

This macro will add a document variable for each check box in the document.
The variable will be named the same as the check box. If you set this as the
exit macro for the check boxes, or include this code in the exit macro for
the check boxes, it will update the value of the variables.

Dim objFormField As FormField

On Error Resume Next
For Each objFormField In ActiveDocument.FormFields
If objFormField.Type = wdFieldFormCheckBox Then
ActiveDocument.Variables.Add Name:=objFormField.Name
ActiveDocument.Variables(objFormField.Name).Value =
objFormField.Result
End If
Next objFormField

That means you'll be able to use something like { DOCVARIABLE "Check1" } for
Expression2.

Note that you'll have to exit from a check box before the values will be
updated correctly, but once you do that, your IF field will work.


Bear
 
Thanks, I would have thought there would have been an easier way.
I'm going to go with a few dropdown boxes this time.
 
Back
Top