Currently I have a macro that change the .BackgroundPatternColor
based on the Drop-Down List Content Control value selected. It applies to the entire table cell.
Code below + screenshot how it looks.
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
With ContentControl.Range
If ContentControl.Title = "Status" Then
Select Case .Text
Case "RED"
.Cells(1).Shading.BackgroundPatternColor = RGB(227, 36, 27)
.Cells(1).Range.Font.TextColor = wdColorWhite
Case "AMBER"
.Cells(1).Shading.BackgroundPatternColor = RGB(251, 171, 24)
.Cells(1).Range.Font.TextColor = wdColorBlack
Case "GREEN"
.Cells(1).Shading.BackgroundPatternColor = RGB(110, 190, 74)
.Cells(1).Range.Font.TextColor = wdColorWhite
Case Else
.Cells(1).Shading.BackgroundPatternColor = wdColorAutomatic
End Select
End If
End With
End Sub
Since you can't change the Text Highlight Color in MS Word via VBA I have discovered I can achieve desired look by changing Style format of Content Control in Properties.
Properties -> +NewStyle -> Format -> Border...
Only then I get my desired "highlighting text" look with custom coluors, instead of changing the entire background of the table cell.
What I want is something like this:
I have created separate style for each selection type.
However, I can't figure out the way to change the Content Control Properties Text Style's based on the current drop-down value selection in MS Word.
Please help. Thanks