Regarding batch page delete for word

Copper Contributor

How do I batch delete entire pages containing a specific word or can I find multiple pages with specific word to extract the entire page? Thanks!

 

1 Reply

@Jin_Quan1010 Use a macro containing the following code

 

Dim strFind As String
strFind = InputBox("insert the word to be found")
Selection.HomeKey wdStory
With Selection.Find
Do While .Execute(FindText:=strFind, Forward:=True, _
MatchWildcards:=False, Wrap:=wdFindStop, MatchCase:=True) = True
ActiveDocument.Bookmarks("\page").Range.Delete
Loop
End With