View Single Post
 
Old 12-07-2015, 06:39 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 Find, select, and replace part of text with bold

I'd like to find a text in a selection and change only a part of the found text by boldfacing it.

For example, first find the text "hello there" in the present selection (e.g. first page of document), then boldface only "there".

Could it be done?


I am struggling with the following sort of VB code. FYI, wildcards are in use.

Selection.Find.ClearFormatting
Selection.Find.Replacement.Font.Bold = True (??????????)
With Selection.Find
.text = "(hello)*(there)"
.Replacement.text = (???????????)
.Forward = True
.MatchWildcards = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Reply With Quote