Using Checkboxes to trigger test insertion later in a document

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

Guest

I have checkboxes entered from the toolbar on the first page of a protected
form document in Word 2000. I would like to be able to test the value of the
checkbox to add text later in the document if the checkbox is checked.

I have not been able to get the following to work:

{If {ref checkbox1} = "1" "insert text" ""}

Just can't seem to get there. Help would be greatly appreciated.
 
After searching for hours I found a solution ....

Assume you have a checkbox bookmarked as TaxExempt

Create the following macro ...

Sub SetTaxExempt()
'
' SetTaxExempt Macro
' Macro created 7/13/2007
'
Dim oFF As FormFields
With ActiveDocument
If .FormFields("TaxExempt").CheckBox.Value = True Then
..Variables("setTaxExempt").Value = "True"
Else
..Variables("setTaxExempt").Value = "False"
End If
..Fields.Update
End With
End Sub

In the checkbox dialog box, set it to execute the setTaxExempt macro on exit
and to calculate on exit.

Then whereever you want to insert text later in the doc based on whether or
not the checkbox is checked, insert the following ....

{IF {DocVariable setTaxExempt} = "True" "This purchase is tax exempt. " ""}

Credit for this solution should go to Greg Maxey posting on the Lockergnome
site.
Hope it helps someone in a bind.

Thanks.
 
Back
Top