View Single Post
 
Old 10-26-2012, 07:01 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Quote:
Originally Posted by mpdsal View Post
Unless I am missing something, when you select a cell within a table and use the copy/paste function it only pastes the related text not the background format.
My Bad - I was thinking that one of the PasteAndFormat options preserved shading info. Nevertheless, you could use something like:
Code:
Sub Demo()
Dim lBkClr As Long, lFrClr As Long, i As Long
With ActiveDocument.Tables(1).Range
  For i = 1 To .Cells.Count
    With .Cells(i)
      .Range.Copy
      lBkClr = .Shading.BackgroundPatternColor
      lFrClr = .Shading.ForegroundPatternColor
    End With
    With ActiveDocument.Tables(2).Range.Cells(i)
      .Range.Paste
      .Shading.BackgroundPatternColor = lBkClr
      .Shading.ForegroundPatternColor = lFrClr
    End With
  Next
End With
Quote:
Also if you use bookmarks it only references the text of the cell none of the shading.
Not so if you're replicating the entire table. Furthermore, if you bookmark an entire cell, the entire cell will be replicated, including its borders & shading in the cross-reference.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote