View Single Post
 
Old 01-06-2021, 04:17 AM
eduzs eduzs is offline Windows 10 Office 2019
Expert
 
Join Date: May 2017
Posts: 266
eduzs is on a distinguished road
Default Remove text between brackets, bookmarks.

This code should remove text between [] inserted in bookmarks, the problem is that it's removing the 1st bookmark at the start of the document.
Any ideas on how to adjust this?
Thanks.
Code:
Sub Test()
    With ActiveDocument.Content.Find
        .Text = "\[*\]"
        .Replacement.Text = ""
        .ClearFormatting
        .Replacement.ClearFormatting
        .MatchWildcards = True
        .Execute Replace:=wdReplaceAll
    End With
End Sub
__________________
Backup your original file before doing any modification.
Reply With Quote