View Single Post
 
Old 08-08-2022, 12:18 AM
macropod's Avatar
macropod macropod is online now Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,375
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
or:
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
Applying/removing bold formatting can be done via:
: .Range.Font.Bold = True
or:
: .Range.Font.Bold = False
as appropriate on each line.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote