Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
beverlydawn beverlydawn is offline
external usenet poster
 
Posts: 6
Default How do I create a macro that uses the Replace command?

I am trying to create a macro that will delete all bold text using Edit and
Replace. I create the Macro, but it does not work. I think it may have
something to do with the dialog boxes that pop up after the replacements.
Any advice?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default How do I create a macro that uses the Replace command?

It has more to do with the inability of the macro recorder to record all the
replace functions. You will have to add the extra lines:

eg to remove all emboldened text (as opposed to removing the bold attribute)

Sub ReplaceExample()
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
'**********************
.Text = ""
.Font.Bold = True
.Replacement.Text = ""
'**********************
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
End With
Selection.Find.Execute replace:=wdReplaceAll
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


beverlydawn wrote:
I am trying to create a macro that will delete all bold text using
Edit and Replace. I create the Macro, but it does not work. I think
it may have something to do with the dialog boxes that pop up after
the replacements. Any advice?



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I assign a macro to a command button Kooljay2 Microsoft Word Help 2 July 18th 06 03:01 PM
BUG with replace command gds Microsoft Word Help 0 October 20th 05 07:39 PM
Why can't I use the Copy command in a macro? terry Microsoft Word Help 1 October 6th 05 05:27 AM
How can I create a macro to find and replace text attributes? pubgal23 Microsoft Word Help 3 September 8th 05 06:09 AM
automate command button in a macro Newbie Mailmerge 0 July 29th 05 09:05 PM


All times are GMT +1. The time now is 07:37 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"