View Single Post
 
Old 12-07-2015, 07:15 PM
paik1002 paik1002 is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: Dec 2015
Posts: 63
paik1002 is on a distinguished road
Default

Thank you, but I can't get it to work.

Code:
Sub Demo()
    Application.ScreenUpdating = False
 
    With ActiveDocument.Range
      With .Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .text = "(hello)*(there)"
        .Replacement.text = ""
        .Forward = True
      .MatchWildcards = True
        .Wrap = wdFindStop
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Execute
      End With
 
      Do While .Find.found
        Words.First.Font.Bold = False
        Words.Last.Font.Bold = True
        .Collapse wdCollapseEnd
        .Find.Execute
      Loop
    End With
    Application.ScreenUpdating = True
End Sub
I modified my code by incorporating your code into it, but I get a 424 run-time error,

Code:
        Words.First.Font.Bold = False
Reply With Quote