View Single Post
 
Old 05-04-2023, 12:12 PM
kevinbradley57 kevinbradley57 is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: Jul 2017
Posts: 85
kevinbradley57 is on a distinguished road
Default Unable to abbreviate "Strong"

I have a dropdown content control in a table cell. The font and background color change based on the selection made. One of the dropdown options is "Strong" and that works fine. I have a request to abbreviate it as "Str" but when I make that change in the VB and in the dropdown, either the background and font colors are both white or it's returning a blank cell (I can't tell which).
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
With ContentControl
      Case "CE"
      Select Case .Range.Text
        Case "Strong": .Range.Cells(1).Shading.BackgroundPatternColor = 6299648: .Range.Cells(1).Range.Font.ColorIndex = wdWhite
        Case "Weak": .Range.Cells(1).Shading.BackgroundPatternColor = 4739264: .Range.Cells(1).Range.Font.ColorIndex = wdWhite
        Case "Sat": .Range.Cells(1).Shading.BackgroundPatternColor = 5880731: .Range.Cells(1).Range.Font.ColorIndex = wdBlack
        Case "IN": .Range.Cells(1).Shading.BackgroundPatternColor = 5232127: .Range.Cells(1).Range.Font.ColorIndex = wdBlack
        Case Else: .Range.Cells(1).Shading.BackgroundPatternColorIndex = wdNoHighlight
      End Select
    Case Else
  End Select
End With
End Sub
Reply With Quote