Not super familiar with VBA, so I feel like this may be a fairly simplistic question, but I can't find a resolution for my issue.
In ms-word, I've made a form in which initially, I wanted specific aspects of the form to hide/display based on different interactions with the form (code down below), which, with some help from another post, works fine, but now I've added text-fields which is causing run-time errors.
Now my issue is that the ContentControlOnExit function is being applied to when a user clicks out of a text field, which I only wanted to apply to when a user clicks out of a chechkbox, which is causing run-time error's.
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim bChecked As Boolean
bChecked = (ContentControl.Checked = True)
If ContentControl.Title = "checkbox1" Then
ActiveDocument.Bookmarks("approve").Range.Font.Hidden = bChecked
End If
If ContentControl.Title = "checkbox2" Then
ActiveDocument.Bookmarks("sign1").Range.Font.Hidden = bChecked
ActiveDocument.Bookmarks("sign2").Range.Font.Hidden = bChecked
End If
If ContentControl.Title = "checkbox3" Then
ActiveDocument.Bookmarks("note").Range.Font.Hidden = bChecked
End If
End Sub
Is there any simple statement I can add so that it doesn't do this check when clicking out of a text-field?
Aucun commentaire:
Enregistrer un commentaire