View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Helmut Weber[_2_] Helmut Weber[_2_] is offline
external usenet poster
 
Posts: 45
Default copying colour from a table cell to another table cell

Hi Purplejopeg,

I couldn't find a way other than to record the source color,
select the target cells afterwards,
and apply the recorded color.

Of course, some vba-knowledge is essential.

Option Explicit
Dim lngColor As Long ' global for module
' -------------------------------
Sub GetColor()
lngColor = Selection.Cells(1).Shading.BackgroundPatternColor
End Sub
' -------------------------------
Sub SetColor()
Selection.Cells.Shading.BackgroundPatternColor = lngColor
End Sub

You may assign the macros to convenient shortcuts.

The value of lngColor might not stay defined forever,
depending on what you do between getcolor and setcolor.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP