mardi 23 juin 2020

Making an area un-editable using a checkbox

I have a word-document and want to make a specific area uneditable (greyed out) if the value of a checkbox is true. My problem is that there are some errors, which I am unable to fix it by myself, hopefully you can help me out with it.

Sub checkBoxStatus()

'declare variables
Dim cb3Y As CheckBox
Dim cb3N As CheckBox

Set cb3Y = ActiveDocument.FormFields(1).CheckBox

cb3Y.Value = False 'just needed this for debugging, to see if I got the right checkbox

End Sub

I got an error message all the time when running this code fragment. "Runtime Error '5941' The Requested Member of Collection Does Not Exist". Unfortunately I don't know where I can edit the id of the right checkbox I need.




Aucun commentaire:

Enregistrer un commentaire