Alright, now... i only ask questions when i really need help... so here goes.

I have documents that have all this highlighting to help notify people of
issues that may or may not be problematic, so i have this-

Sub RemoveHighlights()

Dim rngSearch As Word.Range

Application.ScreenUpdating = False

Set rngSearch = ActiveDocument.Range

rngSearch.Find.ClearFormatting
rngSearch.Find.Replacement.ClearFormatting

With rngSearch.Find
.Format = True
.highLight = True
.Replacement.highLight = False
.Execute Replace:=wdReplaceAll
End With

Application.ScreenUpdating = True

End Sub

Well, i get a document, and it turns out a programmer has added shading, not
highlighting.

I've tried all kinds of things to delete shading using a range, and i can't
figure it out. I searched through past threads and didn't find anything also.

If anyone could help it'd be much appreciated.

Thanks guys.

RE: Delete all shading by davelett

davelett
Thu Feb 09 10:41:48 CST 2006

Hi,

I think you can use something like the following:

With ActiveDocument.Range
.HighlightColorIndex = wdNoHighlight
.Shading.BackgroundPatternColorIndex = wdNoHighlight
End With

HTH,
Dave

"rhamre@citation.com" wrote:

> Alright, now... i only ask questions when i really need help... so here goes.
>
> I have documents that have all this highlighting to help notify people of
> issues that may or may not be problematic, so i have this-
>
> Sub RemoveHighlights()
>
> Dim rngSearch As Word.Range
>
> Application.ScreenUpdating = False
>
> Set rngSearch = ActiveDocument.Range
>
> rngSearch.Find.ClearFormatting
> rngSearch.Find.Replacement.ClearFormatting
>
> With rngSearch.Find
> .Format = True
> .highLight = True
> .Replacement.highLight = False
> .Execute Replace:=wdReplaceAll
> End With
>
> Application.ScreenUpdating = True
>
> End Sub
>
> Well, i get a document, and it turns out a programmer has added shading, not
> highlighting.
>
> I've tried all kinds of things to delete shading using a range, and i can't
> figure it out. I searched through past threads and didn't find anything also.
>
> If anyone could help it'd be much appreciated.
>
> Thanks guys.

RE: Delete all shading by ChuckHenrich

ChuckHenrich
Thu Feb 09 10:49:40 CST 2006

If you want to remove *all* shading and highlighting, you could use the
following instead of find/replace:

With ActiveDocument.Range
With .Font.Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
.HighlightColorIndex = wdNoHighlight
End With

Alternatively you could loop through all the paragraphs (or even words) in
your document looking for a particular shading background color or background
color index and replacing it with 0 (for wdColorAutomatic), eg:

Dim p As Paragraph

For Each p In ActiveDocument.Paragraphs
'XX = index number or constant for the shading
'you want to remove
If p.Range.Font.Shading.BackgroundPatternColorIndex = XX Then
p.Range.Font.Shading.BackgroundPatternColorIndex = 0
End If
Next p

You can also set your criteria to background color, foreground color/color
index, texture, etc.

HTH

--
Chuck Henrich
www.ProductivityApps.com
Stylist Style Generator - automatically create and define sets of paragraph
numbering and heading styles


"rhamre@citation.com" wrote:

> Alright, now... i only ask questions when i really need help... so here goes.
>
> I have documents that have all this highlighting to help notify people of
> issues that may or may not be problematic, so i have this-
>
> Sub RemoveHighlights()
>
> Dim rngSearch As Word.Range
>
> Application.ScreenUpdating = False
>
> Set rngSearch = ActiveDocument.Range
>
> rngSearch.Find.ClearFormatting
> rngSearch.Find.Replacement.ClearFormatting
>
> With rngSearch.Find
> .Format = True
> .highLight = True
> .Replacement.highLight = False
> .Execute Replace:=wdReplaceAll
> End With
>
> Application.ScreenUpdating = True
>
> End Sub
>
> Well, i get a document, and it turns out a programmer has added shading, not
> highlighting.
>
> I've tried all kinds of things to delete shading using a range, and i can't
> figure it out. I searched through past threads and didn't find anything also.
>
> If anyone could help it'd be much appreciated.
>
> Thanks guys.