I am trying to create a form that requires text boxes to be disabled until a checkbox is ticked. Previously I have been able to use activeX and Legacy tools in the document but after a software upgrade to a 3rd party application the manufacture no longer supports these. I am therefore having to re-learn how to use content control boxes and their VBA controls.
This is my attempt based at varying google responses. "Lowers" is the checkbox. "Long3""Long4" "Lat2""Vert2" are the textboxes I am trying to control.
I had managed to disable the textboxes but this now seems to have been lost.
Any suggestions would be greatly appreciated.
Private Lowers_onChange()
Dim oCC_Lowers As ContentControl
Set oCC_Lowers = ActiveDocument.SelectContentControlsByTag("Lowers").Item(1)
Dim oCC_Long3 As ContentControl
Set oCC_Long3 = ActiveDocument.SelectContentControlsByTag("Long3").Item(2)
Dim oCC_Long4 As ContentControl
Set oCC_Long4 = ActiveDocument.SelectContentControlsByTag("Long4").Item(3)
Dim oCC_Lat2 As ContentControl
Set oCC_Lat2 = ActiveDocument.SelectContentControlsByTag("Lat2").Item(4)
Dim oCC_Vert2 As ContentControl
Set oCC_Vert2 = ActiveDocument.SelectContentControlsByTag("Vert2").Item(5)
If oCC_Lowers.LockcontentControl = True Then
oCC_Long3.LockContents = False
oCC_Long4.LockContents = False
oCC_Lat2.LockContents = False
oCC_Vert2.LockContents = False
Else
oCC_Long3.LockContents = True
oCC_Long4.LockContents = True
oCC_Lat2.LockContents = True
oCC_Vert2.LockContents = True
End If
End Sub