View Single Post
  #5   Report Post  
Graham Mayor
 
Posts: n/a
Default

This method will replace manual formatting, but if the paragraphs are
formatted with styles, you need to replace the applied styles with suitable
replacement styles.

e.g. the first macro will replace the manual formatting, the second will
replace styles - but do insert your own style names where indicated.

You can combine the chain the two macros to suit both sets of circumstances

http://www.gmayor.com/installing_macro.htm


Sub ReplaceExample()

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
'**********************
.Text = ""
.Font.Name = "Arial"
.Font.Bold = True
.Font.Size = "12"
.Replacement.Text = ""
.Replacement.Font.Name = "Bookman Old Style"
.Replacement.Font.Size = "11"
.Replacement.Font.Italic = True
'**********************
.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

Sub ReplaceExample2()

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
'**********************
.Text = ""
.Style = "First Style Name"
.Replacement.Style = "Second Style Name"
'**********************
.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





Monill wrote:
We're searching for all occurences of Arial, 12 pt., Bold formatting.
We want to replace with 11 pt., Bookman Old Style, Bold, Italic
formatting.

We go to the Find and Replace dialog box, delete what's in the Find
What
text box then we click More, Format, Font and then make our choices.

After we make the choices and then click Replace All, it states 0
replacements were made. However the Arial, 12 pt., Bold is definitely
there. It doesn't matter where our cursor is in the document before
we begin.

"Suzanne S. Barnhill" wrote:

Please describe what result you are trying to achieve, what you are
doing (the "Find what" and "Replace with" settings), and what
results you are getting.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

"Monill" wrote in message
...
I cannot get find and replace formats to work. I teach at a
community college and the instructions for using this feature in
the text are not working. I am using Office 2003 and Windows XP.