Hi Johnny,
You could use an 'on exit' macro attached to the 'select all' checkbox, coded like:
Code:
Sub CheckAll()
Dim FrmFld As FormField, bChkAll As Boolean
With ActiveDocument
bChkAll = .FormFields("CheckAll").Result
For Each FrmFld In .FormFields
If FrmFld.Type = wdFieldFormCheckBox Then FrmFld.Result = bChkAll
Next
End With
End Sub
Note: The above code assumes your 'select all' checkbox has the bookmark name 'CheckAll' assigned to it. Checking the box checks all checkboxes; unchecking it unchecks them.
For something a little more sophisticated, you could use an 'on entry' macro as well to test the state of the checkbox before it is clicked, with code like the 'GetChkState' below:
Code:
Dim bChkAll As Boolean
Sub CheckAll()
Dim FrmFld As FormField
With ActiveDocument
If .FormFields("CheckAll").Result = bChkAll Then Exit Sub
bChkAll = .FormFields("CheckAll").Result
For Each FrmFld In .FormFields
If FrmFld.Type = wdFieldFormCheckBox Then FrmFld.Result = bChkAll
Next
End With
End Sub
Sub GetChkState()
bChkAll = ActiveDocument.FormFields("CheckAll").Result
End Sub
With this approach, the checkboxes will only be updated if the checked state of the 'select all' checkbox has changed. This might help prevent some accidental updates. Note that the 'CheckAll' sub has been modified to suit and that the 'bChkAll' variable is now module-wide.