Finding highlighted text in autoshape textbox

P

PZ

I modified a macro I found on another group site and its listed below.
The FindHighlights macro detects highlighted text in a Word 2007
document. When the FindHighlights macro finds the first highlighted
text it will pop up the message box prompting the user to correct the
text. The document also contains two autoshape textboxes. The macro
skips the textboxes when it is run. So, if the textboxes contain the
only highlighted text the macro will not pop up the message box.
What's needed to have the macro check the body of the document plus
the textboxes for highlighted text?

Sub FindHighlights()
Dim orng As Range

With Selection.Find

.Highlight = True


While .Execute

Set orng = Selection.Range
If orng.HighlightColorIndex = wdYellow Then
orng.Select
MsgBox "Please correct highlighted text and run the clean
macro again"
Exit Sub
End If
Wend
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top