mardi 30 juin 2020

Declare global CheckBox variable in Word VBA

My word-document has at minimum 2 CheckBoxes. I want to declare them as a global variable to use them often. For some reason I am unable to declare them as variables, which is bad.

Dim cb1 As CheckBox
Dim cb2 As CheckBox
'here are n CheckBoxes possible

cb1 = ActiveDocument.FormFields(1).CheckBox 'here I got a error
'same code for the n CheckBoxes

After I declared them as a global variable I want to set the value of cb2 to False if cb1.Value = True. With this:

If cb1.Value = True Then
    cb2.Value = False
End If

Hopefully you can help me.




Aucun commentaire:

Enregistrer un commentaire