check a checkbox

Z

zSplash

I am trying to check a checkbox, Formfields(5), by code. This is what
doesn't work:
ActiveDocument.FormFields(5).Select '(properly selects the
checkbox)
ActiveDocument.FormFields(5).Result = 1 '(runs fine, but does not
make checkbox checked)

Help, please.

TIA
 
C

Chuck

Try
ActiveDocument.FormFields(5).CheckBox.Value = True
to check the box and
ActiveDocument.FormFields(5).CheckBox.Value = False
to uncheck it
 
G

Greg Maxey

zSplash,

Uses .Value to set the state. Like this:

Sub Test()
ActiveDocument.FormFields(5).Select
ActiveDocument.FormFields(5).CheckBox.Value = 1
End Sub
 
C

Chuck

BTW, you don't need to select the formfield to change its value so you can do
what you want in one line instead of two (unless of course you want to select
the formfield for some other reason).
 
Top