How do I copy table cell colors.

M

MadMeg

I need to color table cells in the corporate color pallete without using
Borders and Shading which is too time consuming on a cell by cell basis. I
tried coloring Message Header but of course the margins are a problem and the
entire cell is not colored. I also tried developing a pallet table but there
is no option for Paste Special on color formats - I am referring to the
actual cell itself NOT the color of the text.
 
S

Suzanne S. Barnhill

Have you tried creating a table style with cells using the desired color
shading? Or saving a properly formatted table as an AutoText entry?
 
M

MadMeg

Table needs to be flexible hence if I preset the table cell colors I still
have the problem I need to develop a table that has colored cells so
template users (who are competant at WORD) simply copy the cell color and
past into their own table were they need it.
 
H

Helmut Weber

Hi MadMeg,

want a macro solution, then like this:

Option Explicit
Dim lCnt As Long
' -------------------------
Sub CopyColor()
lCnt = selection.Cells(1).Shading.BackgroundPatternColor
End Sub
' -------------------------
Sub PasteColor()
selection.Cells(1).Shading.BackgroundPatternColor = lCnt
End Sub

With the usual drawbacks of workarounds, of course,
above all with the drawbacks of a global variable.

It's only to show a possible way.

You could store the color number in the clipboard,
with still other drawbacks.

Or in a document variable.

So many ways.


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
M

MadMeg

Thank you Helmut. Unfortunatley I don't know how to write Macros. Maybe
this is the time to learn. Do you have any more words of wisdom on how to do
this?

Thanks from Toronto Canada!!

MM
 
H

Helmut Weber

Hi MadMeg,

open the VBA-editor, [Alt F11],
from the menu bar in the editor, choose
insert module
copy the macro code from the posting
into the module
save [Ctrl S]
quit the VBA-editor, [Ctrl Q]

Method 1:
From the the menu bar in Word, choose
tools, customize
commands,
in the left listbox select
macros
click the command button
keybord
near to the lower right hand corner of the form
in the left listbox select
macros
in the right listbox select the macro
....
You may now assign a shortcut to the selected macro.

Method 2:
From the from the menu bar in Word, choose
tools, customize
commands,
in the left listbox select
macros
in the right listbox select the macro.
Drag the macro into a command bar of your like:

Hardly possible to describe every detail.
I very likely missed one step or another.

See in addition:
http://word.mvps.org/faqs/macrosvba/CreateAMacro.htm
http://word.mvps.org/faqs/macrosvba/UsingRecorder.htm
http://word.mvps.org/faqs/macrosvba/VBABasicsIn15Mins.htm

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top