Create dependant hidden heading style using drop down selection in Word

TH234 1 Reputation point
2022-08-24T06:09:10.747+00:00

Hi,
I am new and not sure if this is the correct forum. but I am trying to create a form where a heading ('Heading 1') will be hidden if certain selected drop down box options are chosen (i.e. "Notification" or 'Update'). Currently document has VBA coding of the below to colour code selections:

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
With ContentControl.Range
If ContentControl.Title = "Notification Event" Then
Select Case .Text
Case "Notification"
.Cells(1).Shading.BackgroundPatternColor = wdColorRed
Case "Outcome"
.Cells(1).Shading.BackgroundPatternColor = wdColorGreen
Case "Update"
.Cells(1).Shading.BackgroundPatternColor = wdColorOrange
End Select
End If
End With
End Sub

Is this easily doable and can anyone help? Thanks :)

0 comments No comments
{count} votes