Delete all Bold Text in a Macro

G

Greg

I can't figure out how to record a macro that deletes all Bold Text.

Here is what it recorded for me:

Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

For some reason it doesn't record the fact that the format is all bold.

Can anyone help me?
 
H

Helmut Weber

Hi,
For some reason it doesn't record
the fact that the format is all bold.

Blame MS. It simply doesn't.

Try this:

Sub Macro10()
With ActiveDocument.Range.Find
.Font.Bold = True
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
G

Greg Maxey

If you want to delete all bold text then use:

Sub Scratchmacro()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Font.Bold = True
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With
End Sub

If you want to remove the Bold formatting and leave the text you could use:
Sub ScratchmacroII()
ActiveDocument.Range.Font.Bold = False
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

Top