Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Purplejopeg Purplejopeg is offline
external usenet poster
 
Posts: 19
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   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
  #3   Report Post  
Posted to microsoft.public.word.tables
Purplejopeg Purplejopeg is offline
external usenet poster
 
Posts: 19
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   Report Post  
Posted to microsoft.public.word.tables
Klaus Linke Klaus Linke is offline
external usenet poster
 
Posts: 413
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   Report Post  
Posted to microsoft.public.word.tables
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
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


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Colour the entire cell in a Table (not just the text) [email protected] Microsoft Word Help 2 January 5th 08 09:55 PM
How do I lock a cell in a table so no one can type in the cell? Jen0678 Tables 2 April 11th 07 10:50 PM
Cell referencing in table formulas - just ONE adjacent cell Ngan Tables 5 May 20th 06 02:10 AM
How do I move from cell to cell iin a table column in Word 2003? MOSwannabe Tables 4 January 26th 06 10:17 PM
How do I auto copy data from cell in a word table to another cell. Nev New Users 1 February 4th 05 08:51 PM


All times are GMT +1. The time now is 10:07 PM.

Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright 2004-2023 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"