View Single Post
 
Old 12-18-2018, 08:24 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Hi Greg,

Something like that should only be needed if there are vertically-merged cells, in which case, I'd suggest:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim r As Long, TblCell As Cell, Clr As Long
With ContentControl
  If Left(.Title, 6) = "Status" Then
    Select Case .Range.Text
      Case "COMPLETE": Clr = wdGreen
      Case "Pending": Clr = wdYellow
      Case Else: Clr = wdNoHighlight
    End Select
    r = .Range.Cells(1).RowIndex
    With .Range.Tables(1).Range
      For Each TblCell In .Cells
        With TblCell
          If .RowIndex = r Then .Shading.BackgroundPatternColorIndex = Clr
        End With
      Next
    End With
  End If
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]