View Single Post
 
Old 05-16-2020, 04:06 AM
alex100 alex100 is offline Windows 7 64bit Office 2016
Advanced Beginner
 
Join Date: May 2020
Posts: 79
alex100 is on a distinguished road
Default Search and replace, with paragraphs and wildcards

I need to remove all the text between two keywords. So far I have been using this code:

Code:
With Selection
    .HomeKey Unit:=wdStory
    With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "START_KEYWORD(*)END_KEYWORD"
    .MatchWildcards = True
    .Replacement.Text = ""
    .Execute Replace:=wdReplaceAll
    End With
End With
Now I need the search function to include paragraphs too, like this...

Code:
.Text = "START_KEYWORD^p(*)END_KEYWORD"
The problem is that, in such cases, the script no longer works.

Can someone help me, please?

Alex
Reply With Quote