Macro not bolding

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a macro to do various find & replace to a document. One is to
find a word and Bold it. When I was recording the macro I used the Find &
Replace screen. In the Find What box I told it to find the word and in the
Replace box under formatting I went into the font and said to bold it. Then I
said to replace all, it did and the words were bolded. But when I run the
macro it does not Bold the text. The macro does everything else fine. Can
someone help?
 
Could you perhaps show the code you used?

Here is a sample of what you might use:

Sub ScratchMacro()
Dim oRngStory As Word.Range
Dim lngJunk As Long
lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType
For Each oRngStory In ActiveDocument.StoryRanges
Do
With oRngStory.Find
.Text = "Test"
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceAll
End With
Set oRngStory = oRngStory.NextStoryRange
Loop Until oRngStory Is Nothing
Next
End Sub
 

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

Back
Top