Q:

trying to remove lines containing yellow highlighted text

i have a document that i'm reviewing with yellow highlighted text. i want a macro to go through and remove the lines that are highlighted. so far this is what i have:
Sub hilight()
'
' hilight Macro
' removes lines in yellow hi-lighter

Dim p As Paragraph

For Each p In ActiveDocument.Paragraphs
    Dim holder As String
    If p.Range.Text = highlighted_text Then
        p.Range.Text = holder
    End If
Next p

End Sub

i need to know how highlighted text property is given so i can replace highlighted_text 

A:

Here is a solution. Note that it only replaces paragraphs in which the entire paragraph is yellow highlighted, not just part of it. There are a few things worth pointing out:

Replacing a paragraph will also take out the trailing line break, so I include it in the placeholder text
Since a line break is being added, if you don't loop through the paragraphs backwards, it'll be an infinite loop (thus the step -1)
Dim all variables outside of a loop

Sub ReplaceYellowParagrahps()

Dim p As Paragraph
Dim i As Long, count As Long
Dim placeholderText As String
placeholderText = "holder" & vblf

count = ActiveDocument.Paragraphs.count

For i = count To 1 Step -1
    With ActiveDocument.Paragraphs(i).Range
        If .HighlightColorIndex = wdYellow Then
            .Text = placeholderText
        End If
    End With
Next

End Sub

