Code to change highlight on content control automatically
I have code which will change the colour on a content control drop down when the macro isrun, but I would like it to run automatically when I exit the content control, please could you advise?
Sub AddColour()
Dim cc1 As ContentControl
Set cc1 = ActiveDocument.SelectContentControlsByTitle("Ratin g").Item(1)
If cc1.Title = "Rating" Then
Select Case True
Case cc1.Range.Text = "Feasible"
cc1.Range.Shading.BackgroundPatternColor = wdColorGreen
Case cc1.Range.Text = "Less Feasible"
cc1.Range.Shading.BackgroundPatternColor = wdColorYellow
Case cc1.Range.Text = "Not Feasible"
cc1.Range.Shading.BackgroundPatternColor = wdColorRed
Case Else
cc1.Range.Shading.BackgroundPatternColor = wdColorAutomatic
End Select
End If
End Sub
|