Forum Discussion

Jin_Quan1010's avatar
Jin_Quan1010
Copper Contributor
Jun 01, 2024

Regarding batch page delete for word

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!

 

  • 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

Resources