I want the macro to look through the document for any text that is
highlighted (it will be in yellow), and delete the text, and remove the
highlight.

I'd appreciate any help.
Thanks,
J.O.

Re: Macro to look for highlighted text and delete it by Greg

Greg
Fri Sep 01 14:58:24 CDT 2006

Try:

Sub ScratchMacro()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Highlight = True
While .Execute
oRng.Delete
Wend
End With
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


excelnut1954@yahoo.com wrote:
> I want the macro to look through the document for any text that is
> highlighted (it will be in yellow), and delete the text, and remove
> the highlight.
>
> I'd appreciate any help.
> Thanks,
> J.O.



Re: Macro to look for highlighted text and delete it by Helmut

Helmut
Fri Sep 01 15:06:18 CDT 2006

Hi J.O.,

maybe this is sufficient:

Sub Test445()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Highlight = True
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With
End Sub

HTH


--
Gruß

Helmut Weber, MVP WordVBA

"red.sys" & chr$(64) & "t-online.de"
Win XP, Office 2003 (US-Versions)


Re: Macro to look for highlighted text and delete it by excelnut1954

excelnut1954
Fri Sep 15 08:22:14 CDT 2006

I've been away from all this.... so, thanks to both of you for your
solutions. I'll try them today.
Thanks again
J=2EO.
Helmut Weber wrote:
> Hi J.O.,
>
> maybe this is sufficient:
>
> Sub Test445()
> Dim rDcm As Range
> Set rDcm =3D ActiveDocument.Range
> With rDcm.Find
> .Highlight =3D True
> .Replacement.Text =3D ""
> .Execute Replace:=3DwdReplaceAll
> End With
> End Sub
>
> HTH
>
>
> --
> Gru=DF
>
> Helmut Weber, MVP WordVBA
>
> "red.sys" & chr$(64) & "t-online.de"
> Win XP, Office 2003 (US-Versions)