View Single Post
 
Old 09-19-2014, 05:48 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,427
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

The code works. Run this code in a new document to illustrate.

Code:
Sub Color()
With ActiveDocument
  .Tables.Add Selection.Range, 5, 5
  .Tables(1).Cell(2, 3).Shading.BackgroundPatternColor = RGB(51, 51, 153)
  .Tables(1).Cell(3, 2).Shading.BackgroundPatternColor = RGB(51, 51, 153)
  ChangeLogo ActiveDocument
End With
End Sub
 Function ChangeLogo(wdDoc)
Dim oCell As Cell, oTbl As Table, oRow As Row
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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote