cartman101 said:
I have written a visual basic macro in word which opens a Form to
allow the user to enter data.
This form contains a check box with the default value set to True (ie
checkbox ticked)
Is it possible to chage the default value for this checkbox to False
using a macro.
Any help apperciated
Mike
Hi Mike,
The answer depends on what kind of form contains the checkbox and what kind
of checkbox it is. There are at least three different ones. The strange part
is that you must have done something to change the default value to True,
because every one of these has a default value of False when it's first
created -- can you remember doing anything like this?
If the form is a Userform (a custom dialog created in the VBA editor), you
can use the Properties pane in the editor to set the Value property to
False, or you can use code like this to set the value in the
Userform_Initialize or Userform_Activate procedure:
Private Sub UserForm_Initialize()
CheckBox1.Value = False
End Sub
If the form is in the body of a document or template, did you create the
checkbox from the Forms toolbar or from the Control Toolbox?
- If it's from the Forms toolbar, open its Properties dialog and click the
"Not checked" radio button.
- If it's from the Control Toolbox, open its Properties dialog and change
its Value property to False. Like the Userform case, you can set the Value
in code, but here it would go in the Document_New procedure (see
http://word.mvps.org/FAQs/MacrosVBA/DocumentEvents.htm).