View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default how can I copy color fill with Text in WORD Tables?

RosalieP wrote:
I've created a WORD table that I want to use as a template.

And am trying to copy a cell with its background color / fill to a
new cell. But only the text copies over, not the color fill.

Am I missing something? Is it possible to copy the color fill with
the text to a new cell?


There is no tool for "copying" the color of cell shading. There are two
methods: manual and macro.

For the manual method, select the cell that has the desired background. Open
the Format Background & Shading dialog and click the Shading tab. A box in
the upper-center area of the dialog will tell you the RGB color currently
applied to the cell. Write it down. :-( Close the dialog, select the other
cell (or table), reopen the dialog, and apply the same RGB color in the More
Colors sub-dialog. Caution: pay special attention to the setting of the
"Apply to" box in the Shading dialog, because Word tends to guess wrong.

Having set the color of the second cell, you can repeatedly select another
cell and press F4 to repeat the color assignment, as long as you don't do
anything else in between.

The macro method depends on exactly what you want to do. Here's a very
simple macro that just copies the color from the top left cell of the
current table to the entire table. It can be modified extensively to let you
choose which table(s) to color, where the source cell is, and what
destination cell(s) to use. See http://www.gmayor.com/installing_macro.htm
if needed.

Sub TableBackColor()
' set the background color of
' an entire table the same as
' that of the first cell

If Not Selection.Information(wdWithInTable) Then
MsgBox "Put the cursor in a table"
Exit Sub
End If

Dim backColor As Long
Dim foreColor As Long

With Selection.Tables(1)
backColor = .Cell(1, 1).Shading.BackgroundPatternColor
foreColor = .Cell(1, 1).Shading.ForegroundPatternColor
.Shading.BackgroundPatternColor = backColor
.Shading.ForegroundPatternColor = foreColor
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.