I have a document and it has multiple tables with shading.
The shading ranges from 20-35 percent. I am using WORD97.
How can I do a edit/replace in VB to find all the shading and
replace it with 10%.
Hi Debbie,
Edit > Replace doesn't work for this.
You'd loop through all cells in all tables, and set the shading to 10% if
it is currently 20-35 percent.
If you want to apply 10% shading to all cells that currently have any
shading at all (other than "automatic" = none):
Dim myTable As Table
Dim myCell As Cell
For Each myTable In ActiveDocument.Tables
For Each myCell In myTable.Range.Cells
With myCell.Shading
If .BackgroundPatternColor <> _
wdColorAutomatic Then
.BackgroundPatternColor = wdColorGray10
End If
End With
Next myCell
Next myTable
I'm not sure if Word97 used RGB colors, or if it used textures. If the
latter, you would write something like
If .Texture <> wdTextureNone Then
.Texture = wdTexture10Percent
End If
in the inner loop.
Regards,
Klaus