Hi all,
I have a word doco with checkboxes and thanks to help I have received I have been able count if the checkboxes are checked. But because I have about 50 check boxes on my form and my form is broken up into sections I want to be able to count the checkboxes by a range, so from checkbox1 - checkbox30.
Someone suggested I use an array but doesn't that only work for excel?
Any way below is my code
Sub CountChecks()
Dim oFld As FormField
Dim i As Integer
For Each oFld In ActiveDocument.FormFields
If oFld.Type = wdFieldFormCheckBox Then
If oFld.Result = True Then i = i + 1
End If
Next
MsgBox "There are " & i & " checked boxes."
End Sub
Some people make things happen, some watch while things happen, and some wonder 'What happened?'
I have a word doco with checkboxes and thanks to help I have received I have been able count if the checkboxes are checked. But because I have about 50 check boxes on my form and my form is broken up into sections I want to be able to count the checkboxes by a range, so from checkbox1 - checkbox30.
Someone suggested I use an array but doesn't that only work for excel?
Any way below is my code
Sub CountChecks()
Dim oFld As FormField
Dim i As Integer
For Each oFld In ActiveDocument.FormFields
If oFld.Type = wdFieldFormCheckBox Then
If oFld.Result = True Then i = i + 1
End If
Next
MsgBox "There are " & i & " checked boxes."
End Sub
Some people make things happen, some watch while things happen, and some wonder 'What happened?'