Changing Font Color in drop down list

DailyDrama

New Member
Joined
Nov 26, 2019
Messages
2
Office Version
2013
Platform
Windows
Hi, i have a drop down list that i want to change the font color of based on the selection. Two out of three of my selections/Font color change work - but i cannot get "Amber" to work. I have "white" as the font colour - it works, but when i change the color to Amber or Orange - it doesnt work. What am i doing wrong??

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
With ContentControl.Range
If ContentControl.Title = "Status" Then
Select Case .Text
Case "GREEN - controls green or <=2 controls amber"
.Font.ColorIndex = wdGreen
.Cells(1).Shading.BackgroundPatternColor = wdColorGreen
Case "AMBER - >2 controls amber - up to 6, No more than 1 control red"
.Font.ColorIndex = wdWhite
.Cells(1).Shading.BackgroundPatternColor = wdColorOrange
Case "RED - >1 control Red"
.Font.ColorIndex = wdRed
.Cells(1).Shading.BackgroundPatternColor = wdColorRed
 

KOKOSEK

Board Regular
Joined
Apr 8, 2019
Messages
158
Office Version
365, 2013
Platform
Windows
if you try:

Code:
.Font.ColorIndex = wdAmber
it can't works.

Check pallet of excel colours here
 

DailyDrama

New Member
Joined
Nov 26, 2019
Messages
2
Office Version
2013
Platform
Windows
Hi Kokosek,
thanks but i have used "amber" as the font colour in the code - it justs displays as black (automatic). I am just using "white" as a second option.
- from what i am reading - only colours 1-8 can be used?? Orange (46) or light orange (45) dont seem to work in the code as a number or as RGB (X,X,X) - the code debugger comes up.
 

KOKOSEK

Board Regular
Joined
Apr 8, 2019
Messages
158
Office Version
365, 2013
Platform
Windows
If you use it like:

Code:
.Font.ColorIndex = RGB(255,102,0)
it gives error but:
Code:
.Font.Color = RGB(255,102,0)
should works.

Not tested.
 

Forum statistics

Threads
1,078,373
Messages
5,339,816
Members
399,334
Latest member
Grace Ford

Some videos you may like

This Week's Hot Topics

Top