Quote:
Originally Posted by gmayor
You need to identify the table the cells are in e.g.
Code:
Function ChangeLogo(wdDoc)
Dim oTable As Table
Dim ocell As Cell
Set oTable = wdDoc.Tables(1)
For Each ocell In oTable.Range.Cells
With ocell.Shading
If .BackgroundPatternColor = RGB(51, 51, 153) Then
.BackgroundPatternColor = RGB(12, 71, 157)
.ForegroundPatternColor = wdColorWhite
End If
End With
Next ocell
End Function
|
I did it this way? any thoughts?
Code:
Function ChangeLogo(wdDoc)
Dim oCell As Cell, oTbl As Table, oRow As Row, oRng As Range
Dim i As Long
For Each oTbl In wdDoc.Tables
For Each oRow In oTbl.Rows
For Each oCell In oRow.Cells
If oCell.Shading.BackgroundPatternColor = RGB(51, 51, 153) Then
oCell.Shading.BackgroundPatternColor = RGB(12, 71, 157)
End If
Next
Next
Next
End Function
having troubles changing the text colour in the cell. Any suggestions?