Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automated check Box in word 1

Status
Not open for further replies.

julesNDC

IS-IT--Management
Dec 2, 2005
81
US
Hello,

I am trying to figure out how to have multiple check boxes checked at once.


I have 4 check boxes in a word document next to comments and a 5th box with the comment “check all”.
The goal is to have all boxes automatically checked if a user puts a check mark in box #5

Can this be done?

Thanks!
 
Can this be done?"

Yes.

A little more detail would help.

1. what version of Word. BTW: you should always mention version when posting.

2. what kind of checkboxes? ActiveX checkboxes (from the Controls toolbar), or formfield checkboxes (from the Forms toolbar)?

If the 5th is a formfield checkbox, you could have an OnExit macro for it. The macro would see the status of the 5th checkbox, and if checked set the other four as checked (regardless of their current state). A simplistic example:
Code:
Dim DocFF As FormFields
Set DocFF = ActiveDocument.FormFields
If DocFF("Check5").CheckBox.Value = True Then
   DocFF("Check1").CheckBox.Value = True
   DocFF("Check2").CheckBox.Value = True
   DocFF("Check3").CheckBox.Value = True
   DocFF("Check4").CheckBox.Value = True
End If

If it is an ActiveX checkbox, then you could have its Change event set the other four.
Code:
Sub CheckBox5_Change()
If CheckBox5.Value = True Then
   CheckBox1.Value = True
   CheckBox2.Value = True
   CheckBox3.Value = True
   CheckBox4.Value = True
End If
   
End Sub
NOTE! the above code does not handle if you UNCHECK the 5th one. Say you check it, and the other four are now checked. What happens if you UNCHECK the 5th one? Do you want all the other now unchecked? Again, the above code (for either formfield or ActiveX control) does NOT handle this.

What to do about it is a logical decision, and must be made by you.

As this is actually a VBA solution, if you wish to pursue this route, you should post any further questions to the VBA forum.

faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top