Check box

H

herbie000

I have two check boxes one yes and one no how do I set them up so the
user can select only one of them.

This is a stupid question but is the only way to get these check boxes
to work is to have the document protected? Is there a way to only
protect part of a document? The reason I ask is there are parts of the
document that the user will be filling out. I have written a macro and
created a "button" that will let them run spell check. But they can't
use any formatting tools like bold, italics or bullets.


Any ideas would be greatly appreciated.
 
G

Graham Mayor

Why do you need two linked check boxes for yes or no? Surely one checked
would be yes and not checked no? Then you could use an alternative method
for inserting a check box eg http://www.gmayor.com/Macrobutton.htm which
would not require you to lock the form. Otherwise you would need a macro run
on exit from each of the check boxes - eg

Sub is1Checked()
With ActiveDocument
If .FormFields("Check1").CheckBox.Value = True Then
.FormFields("Check2").CheckBox.Value = False
End If
If .FormFields("Check1").CheckBox.Value = False Then
.FormFields("Check2").CheckBox.Value = True
End If
End With
End Sub

Sub is2Checked()
With ActiveDocument
If .FormFields("Check2").CheckBox.Value = True Then
.FormFields("Check1").CheckBox.Value = False
End If
If .FormFields("Check2").CheckBox.Value = False Then
.FormFields("Check1").CheckBox.Value = True
End If
End With
End Sub

You could use an unprotected section for free text.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
H

herbie000

I needed 2 linked check boxes because that is how the users want it, not
my choice :(

I have gone away from having the users just click on the box and have
created a macro button. This works great on my machine but when I go
to other machines the auto text info is not following along and it
errors when the buttons are clicked. Do I have to set up the auto text
on every machine? If so I may have to go back to running a macro on
exit of the check boxes. But I don't think that will work either as
there are several in the Doc. and somehow it would have to turn the
protection back on so the other check boxes work....GURRRR

Any thoughts on how or a better way to make this work?
 
G

Graham Mayor

You cannot store autotext in a document. The autotext entries would have to
be stored in a template - either the document template or a global template
either of which the users would require access to.

The linked check box macros I posted earlier do not require the form to be
unlocked in order to work.The macros are run on exit from their associated
check boxes. For other check box pairs you would need similar macros
addressed to the particular check boxes (the macros posted were for Check1
and 2)

I still think that the best plan is to have one check box - checked for Yes
unchecked for No (or vice versa) such a check box doesn't need a macro. Its
indication should be sufficient.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
H

herbie000

I tried to use the check1 and 2 macro you posted on a new doc. but I
could not get it to work. I must not be doing something wrong.

The problem with only have one check box is how do you know the user
did not just miss checking it?

buy the way thanks for the help so far!
 
G

Graham Mayor

The 'is1Checked' macro should be configured to run on exit from the field
bookmarked Check1 (right click > properties) and the 'is2Checked' macro
should be configured to run on exit from the field bookmarked check2. As you
tab out of these fields the other field is set to the opposite value.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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