A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

copying colour from a table cell to another table cell



 
 
Thread Tools Display Modes
  #1  
Old January 29th, 2008, 11:16 AM posted to microsoft.public.word.tables
Purplejopeg
external usenet poster
 
Posts: 25
Default copying colour from a table cell to another table cell

I have produced a specific colour in a cell, I now want to use it in another
table in the same document, how can I copy the colour?
  #2  
Old January 29th, 2008, 01:40 PM posted to microsoft.public.word.tables
Helmut Weber[_2_]
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
  #3  
Old January 29th, 2008, 02:04 PM posted to microsoft.public.word.tables
Purplejopeg
external usenet poster
 
Posts: 25
Default copying colour from a table cell to another table cell

Thanks, but I don't have any vba knowledge, guess it is visual basic. I have
managed to find out the colour breakdown so all is not lost, but it is very
slow.



"Helmut Weber" wrote:

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

  #4  
Old February 2nd, 2008, 01:18 PM posted to microsoft.public.word.tables
Klaus Linke
external usenet poster
 
Posts: 401
Default copying colour from a table cell to another table cell

If you've applied the colour once, you can apply it to other cells with F4
(EditRedoOrRepeat).
I thought it would be enough to open and close the BordersAndShading dialog
with the cursor in the cell you want to "copy" from, to pick up the colour,
but that does not seem to work in Word 2003.

Regards,
Klaus

  #5  
Old February 20th, 2008, 01:34 PM posted to microsoft.public.word.tables
Stefan Blom
external usenet poster
 
Posts: 8,433
Default copying colour from a table cell to another table cell

FWIW, it doesn't seem to be working in Word 2007 either. The *borders* can be
picked up by visiting the Borders and Shading dialog, and then pressing F4,
though.

--
Stefan Blom
Microsoft Word MVP


"Klaus Linke" wrote:

If you've applied the colour once, you can apply it to other cells with F4
(EditRedoOrRepeat).
I thought it would be enough to open and close the BordersAndShading dialog
with the cursor in the cell you want to "copy" from, to pick up the colour,
but that does not seem to work in Word 2003.

Regards,
Klaus


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.