Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2006

Tip: Looking for answers? Try searching our database.

Delete all Bold Text in a Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg - 15 Aug 2006 23:12 GMT
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?
Helmut Weber - 16 Aug 2006 00:10 GMT
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

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

Greg Maxey - 16 Aug 2006 00:14 GMT
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

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> I can't figure out how to record a macro that deletes all Bold Text.
>
[quoted text clipped - 19 lines]
>
> Can anyone help me?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.