Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Lene Fredborg Lene Fredborg is offline
external usenet poster
 
Posts: 1,291
Default Global replace of Table Shading

You can use macros to quickly change cell shading and all other properties of
cells, rows, columns and entire tables.

The macro below checks the cell shading of all cells in the *selection*. If
the cell has the shading you search for (oColor_Old), the shading will be
replaced by the shading defined as oColor_New. If not, no changes will be
made to the cell.

Before executing the macro, select the part of the document that contains
the cells you want to search (single cell(s), row(s), columns(s), whole
table(s) or even the entire document as you wish).

TIP: To find the names of the colors to use, you can record a macro in which
you change the shading of 2 cells to the old and new color, respectively. In
the recorded macro, find the values of BackgroundPatternColor.

Here is the macro:

Sub ChangeTableCellShading_SelectedCells()

Dim oCell As Cell
Dim oColor_Old As WdColor
Dim oColor_New As WdColor

'Replace the shading below by the one to search for:
oColor_Old = wdColorYellow
'Replace the shading below by the new shading to apply:
oColor_New = wdColorBrightGreen

'iterate through all cells in the selection
For Each oCell In Selection.Range.Cells
'If shading is the one being search for, replace it
With oCell.Shading
If .BackgroundPatternColor = oColor_Old Then
.BackgroundPatternColor = oColor_New
End If
End With
Next oCell

End Sub

--
Regards
Lene Fredborg


"MJSEA" wrote:

Is there a quick way to search for a particular shading color within a row
and replace it with a different color?

Is it possible to search for any other table properties and replace them,
e.g., table size?

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
Trouble Sorting Table Joe McGuire Microsoft Word Help 5 October 2nd 06 09:48 PM
Document Styles should be assignable to fonts in Table AutoFormat Natasha A. Tables 5 November 11th 05 05:49 PM
table cells loose shading during merge operation RandyAAEPA Mailmerge 0 September 8th 05 05:36 PM
Table AutoFormats vs. Table Styles confusion Tony Jollans Tables 5 March 6th 05 07:18 PM
MAKRO Help needed: Search & Replace from Top to start of Table Frank Microsoft Word Help 1 December 10th 04 05:49 PM


All times are GMT +1. The time now is 10:01 AM.

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

About Us

"It's about Microsoft Word"