Checkbox

D

Danny

When one check box is checked I want to have others checked in the same
msword document. For instance if one checkbox is checked in a protected
document how do you link to another checkbox so that it is checked too? I
have used ref to link text boxes but that does not work with checkboxes.
 
G

Greg Maxey

Danny,

Thought for sure that I answered this a few days ago, but I can't find the
post. You can do it with a macro set to run on exit from the master
checkbox. Something like:

Sub DupCheckMark()
If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then
ActiveDocument.FormFields("Check2").CheckBox.Value = True
ActiveDocument.FormFields("Check3").CheckBox.Value = True
Else
ActiveDocument.FormFields("Check2").CheckBox.Value = False
ActiveDocument.FormFields("Check3").CheckBox.Value = False
End If
End Sub
 
G

Guest

Greg, I have several checkboxs that I want to check the first one and then
have it check the other 3. When I use your code below it works for the first
three but will not work for the fourth one. Is there a reason? Also, I
have about 7 checkboxes on this form that I need to do the same thing with,
is this possible?
 
C

Charles Kenyon

You can find code for synchronizing checkbox results in the sample with my
checkbox template at http://addbalance.com/word/download.htm.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
G

Greg

Loretta,

I am sure it is possible. The code I posted for Danny was for Danny's
specific issue.

You need to define bookmarks names for your checkboxes. Check1,
Check2, etc. are the default names created when you created the
checkboxes. Lets call your first group CheckSetA

So, unlock the form and double-click on the master checkbox of that
group and change its bookmark name to CheckSetA1. Open the other three
and name them CheckSetA2, etc.

Your code to run on exit from CheckSetA would be something like:

Sub CheckSetA()
Dim oFflds As FormFields
Dim i As Long
Set oFflds = ActiveDocument.FormFields
If oFflds("CheckSetA1").CheckBox.Value = True Then
For i = 2 To 4
oFflds("CheckSetA" & i).CheckBox.Value = True
Next i
Else
For i = 2 To 4
oFflds("CheckSetA" & i).CheckBox.Value = False
Next i
End If
End Sub

You will need to create a similar macro to run on exit from the master
checkbox of your other six sets. Just be sure to use a sequence like
CheckSetB, CheckSetC, and define the members of each set sequentially.

In your individual macros, be sure the For i = 2 To ??? the ??? is the
highest numbered checkbox in that set.

Post back if you have problems.
 
G

Guest

I could not find where it would allow me to check one box and it check 3 more
boxes in the protected document. I have at least 7 different checkboxes on
this one form that I need to check 3 more boxes after the first one of each
of those 7 are checked.
 
G

Greg

Loretta,

I doubt that Charle's webpage is going to deal specifically with your
issue. I posted an answer to your question last Friday. I see that it
is visible in Google groups, but if for some reason you can't find it,
let me know and I will repost.
 
C

Charles Kenyon

Did you download it? It has a document with the specific code for
replicating checkbox responses.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
J

John McGhie [MVP - Word and Word Macintosh]

Look up the OnExit event in the VBA help :)


How do you set a macro to run on exit from the checkbox? I have word 2003.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
 

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