![]() |
|
|
|
#1
|
|||
|
|||
|
Hi,
I have the following code that sucessfully changes the text color of a drop down box in Microsoft Word depending on the selection. How do i also change the background color Code:
If .Title = "Condition" Then
Select Case .Range.Text
Case "High": .Range.Font.Color = RGB(192, 0, 0)
Case "Medium": .Range.Font.Color = RGB(192, 0, 0)
Case "Low": .Range.Font.Color = RGB(64, 64, 64)
Case Else: .Range.Shading.BackgroundPatternColorIndex = wdNoHighlight
End Select
End If
|
|
#2
|
||||
|
||||
|
For example:
Code:
If .Title = "Condition" Then
Select Case .Range.Text
Case "High": .Range.Font.Color = RGB(192, 0, 0): .Range.HighlightColorIndex = wdRed
Case "Medium": .Range.Font.Color = RGB(192, 0, 0): .Range.HighlightColorIndex = wdYellow
Case "Low": .Range.Font.Color = RGB(64, 64, 64): .Range.HighlightColorIndex = wdBrightGreen
Case Else: .Range.Shading.BackgroundPatternColorIndex = wdNoHighlight
End Select: .Range.HighlightColorIndex = wdNoHighlight
End If
Code:
If .Title = "Condition" Then
Select Case .Range.Text
Case "High": .Range.Font.Color = RGB(192, 0, 0): .Range.Shading.BackgroundPatternColorIndex = wdRed
Case "Medium": .Range.Font.Color = RGB(192, 0, 0): .Range.Shading.BackgroundPatternColorIndex = wdYellow
Case "Low": .Range.Font.Color = RGB(64, 64, 64): .Range.Shading.BackgroundPatternColorIndex = wdBrightGreen
Case Else: .Range.Shading.BackgroundPatternColorIndex = wdNoHighlight
End Select
End If
: .Range.Font.Bold = True or: : .Range.Font.Bold = False as appropriate on each line.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Manipulate references - make them bold or change between Harvard/APA and Oxford?
|
flygare | Word | 2 | 05-30-2020 04:59 AM |
Word 16/19 change font and outside border color (same color) eg is red change to pink
|
jec1 | Word VBA | 2 | 12-04-2019 11:32 PM |
| Change to Bold font behaviour in Word 2016? | jharrop | Word | 3 | 08-06-2018 05:31 PM |
| how to search and replace BOLD text >> font color change? | dylansmith | Word | 4 | 03-12-2013 09:51 PM |
Make Font Dropdown Change All Styles' Font
|
trevorhiller | Word | 1 | 04-14-2012 02:14 AM |