Bolding the word.

D

Designingsally

I m trying to find and replace a phrase. I want one word in the replaced
phrase to be in bold. I dont know the bold command and how to go abt it. Can
someone help me thru this if the process is feasiable. I know Font.Bold is
for marking bold. But how do i specify to a particular word in a sentence or
a phrase

For ex:

Click next to continue ' phrase to be found
Click next to continue 'replace with this string, where the next alone shd
be in done for the user during the output.


Dim oRng As Range
Dim sRep As String
Dim sFindText As String
Dim sRepText As String
sFindText = "Click Next to continue" 'Replace to find
sRepText = "Click Next to continue" 'Replace to replace THE "NEXT" HERE SHD
BE REPLACED AS BOLD AS THE OUTPUT.
With Selection
..HomeKey wdStory
With .FInd
..ClearFormatting
..Replacement.ClearFormatting
..Wrap = wdFindContinue
..Format = False
..MatchCase = True
..MatchWholeWord = True
..MatchWildcards = False
..MatchSoundsLike = False
..MatchAllWordForms = False
While .Execute(findText:=sFindText)
Set oRng = Selection.Range
sRep = Msgbox("Use click next to continue")
Wend
 
G

Graham Mayor

Dim oRng As Range
Dim sFindText As String
sFindText = "Click Next to continue" 'Replace to find
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
While .Execute(findText:=sFindText)
Set oRng = Selection.Range
oRng.Words(2).Bold = True
Wend
End With
End With


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top