Making a check box that will automatically put in check when click

D

d.carlin

We are making a form that will be filled out on the internet and must have a
check box that will put a check mark into the box when clicked on. The
directions from "help" are not making it happen. The form has been created
and the check boxes added to it, could this be the problem? How to fix?
HELP!
 
J

Jen Woodall

I would like to make a form with check boxes that when clicked additional
text appears. IE. if you click "yes" than instructions for "yes" appear.
Any tips for this?
 
D

Doug Robbins - Word MVP

Where do you want the instructions to appear? In the actual document or as
a message box on the screen. Also what type of form is this? A document
containing formfields that is protected, or a custom dialog (UserForm).

For the former, say you have a Checkbox to which has been assigned the
bookmark "Check1", if you set a macro containing the following code to be
run on exit from that checkbox (access the Properties dialog of that
formfield to do this), a message will be display when the user checks that
box and exits from it

If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then
MsgBox "Here is a message."
End If

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jen Woodall

Thanks, that helps. I think I almost have it.

Doug Robbins - Word MVP said:
Where do you want the instructions to appear? In the actual document or as
a message box on the screen. Also what type of form is this? A document
containing formfields that is protected, or a custom dialog (UserForm).

For the former, say you have a Checkbox to which has been assigned the
bookmark "Check1", if you set a macro containing the following code to be
run on exit from that checkbox (access the Properties dialog of that
formfield to do this), a message will be display when the user checks that
box and exits from it

If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then
MsgBox "Here is a message."
End If

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jen Woodall

I have set another text form field with a bookmark for the text to appear in.
I am using a protected document and I tried to set up a code for
unprotecting and reprotecting the document.
This is what I've done:
Sub pToggleProtectDoc()

If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect
Else
ActiveDocument.Unprotect
End If

End Sub
Sub IH()
pToggleProtectDoc

' IH Macro
If ActiveDocument.FormFields("bkIH").CheckBox.Value = True Then
ActiveDocument.Bookmarks("bkIHadd").Range.Text = "1212 Second Street N.
Cranbrook, BC V1C 4T6"

End If
pToggleProtectDoc

End Sub

But it is still telling me that the macros are disabled. ???
 
D

Doug Robbins - Word MVP

If you insert a textbox type formfield where you have the bookmark, with
that bookmark name being assigned to the formfield, you can use the .Result
attribute of the formfield to load the information into it, which can be
done without unprotecting the document

With ActiveDocument
If .FormFields("bkIH").CheckBox.Value = True Then
.FormFields ("bkIHadd").Result= "1212 Second Street N. Cranbrook, BC
V1C 4T6"
End If
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jen Woodall

You are awesome. Thank-you!
My next question is;

I have a drop down box with an "other" option. When the other option is
chosen I want a text field to appear. Is this possible? I guess the first
part could be
If ActiveDocument.FormFields(bk).DropDown.Value = other then
???
 
D

Doug Robbins - Word MVP

With ActiveDocument
If .FormFields("Dropdown1").Result = "Other" Then
.FormFields("Text1").Range.Font.Hidden = False
Else
.FormFields("Text1").Range.Font.Hidden = True
End If
End With

Start with the font of the Text1 formfield formatted as hidden.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jen Woodall

That works, but when tabbing thru the document I still land on that text
line. Is there a way to make it skip that one?
 
D

Doug Robbins - Word MVP

Try

With ActiveDocument
If .FormFields("Dropdown1").Result = "Other" Then
.FormFields("Text1").Range.Font.Hidden = False
Else
.FormFields("Text1").Range.Font.Hidden = True
SendKeys "{Tab}"
End If
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top