DEV Community

Oscar Sun(孫守真字任真)
Oscar Sun(孫守真字任真)

Posted on

Answer: MS Word advanced search and replace

Without wildcard, can you accept? How about VBA?

Sub MS_Word_advanced_search_and_replace()
    Dim a As Range, d As Document, i As Long, ur As UndoRecord, a1 As Range
    Set ur = Word.Application.UndoRecord
    ur.StartCustomRecord "MS_Word_advanced_search_and_replace"
    Word.Application.ScreenUpdating = False
    Set d = ActiveDocument
    Set a = d.Range
    With a.Find
        .ClearFormatting
        .Font.Bold = True

Top comments (0)