global removal of a phrase

E

Elfego Baca

I have a very large word document, over 1000 pages. There are over 10,000
phrases within parenthesis that contain the word memo) I would like a macro
that would look for all instances of parenthesis that contains the word
'memo' and removed the entire phrase including the opening and ending
parenthesis. For example I need a macro that would remove the following
groups:
(red sunset memo) (memo san francisco) (edward the great memo), but would
not remove (John Smith explorer)
 
G

Graham Mayor

The solution is only slightly different from that to which you asked
yesterday

Sub FindAndDeleteSpecial()
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "\(*<memo>*\)"
Do While .Execute(Forward:=True, _
MatchWildcards:=True) = True
oRng.Delete
Loop
End With
End Sub

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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