View Single Post
 
Old 08-20-2019, 03:01 PM
GDaddy35803 GDaddy35803 is offline Windows 10 Office 2019
Novice
 
Join Date: Aug 2019
Posts: 1
GDaddy35803 is on a distinguished road
Default Need help with colorcoding a drop down list

Hello Paul,

I tried to do as you instructed but can't seem to see the code in your attachment.

I am not a coder, but this is what I am looking to do: make a drop down list in Word [done] but when I pick a word "Critical, High, Medium, Low, None" I want it displayed in the colors below. When I run the below VBScript they all display green. I copied this code off the internet and it change the whole cell one of the colors, but I just want the text. So what does the last line need to be as well?

Code:
With ContentControl.Range
    If ContentControl.Title = "Severity" Then
        Select Case .Text
            Case "Critical"
                .Attributes.Add("style", "color:Dark Red")
            Case "High"
                .Attributes.Add("style", "color:Red")
            Case "Medium"
                .Attributes.Add("style", "color:Orange")
            Case "Low"
                .Attributes.Add("style", "color:Blue")
            Case "None"
                .Attributes.Add("style", "color:Green")
            Case Else
                .Cells(1).Shading.BackgroundPatternColor = wdColorAutomatic
        End Select
    End If
End With
End Sub
Reply With Quote