Hello, i want to count the checkboxes in my Word document, i wrote something but there is something wrong with the counter.
After clicking the button, the function checks the checkboxes and only displays those which have been checked.
Thanks
Private Sub CommandButton1_Click()
With ActiveDocument
Dim intI As Integer
intI = 1
Dim Str As String
Str = "CaseACocher"
Dim Str2 As String
Dim Compteur As Integer
Compteur = 0
For Each fldCheck In ActiveDocument.FormFields
If fldCheck.Type = CheckBox Then
Compteur = Compteur + 1
End If
Next fldCheck
For intI = 1 To Compteur Step 1
Str2 = Str & intI
If .FormFields(Str2).CheckBox.Value = False Then
.Bookmarks(Str2).Range.Font.Hidden = True
Else
.Bookmarks(Str2).Range.Font.Hidden = False
End If
Next intI
.Protect wdAllowOnlyFormFields, noreset
End With
End Sub