Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Kay Kay is offline
external usenet poster
 
Posts: 33
Default Find and Replace Macros for formatting

Hello all,

Our goal is to find any text with formatting of Arial, bold Italic and 14
pts and replace that with a Heading 2 Style. If you record the macro the
steps work, but nothing happens when you play back the macro on another
document. My code is below.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/21/2008 by Genzyme Corporation
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("Heading 2")
Selection.Find.Replacement.ParagraphFormat.Borders .Shadow = False
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
End Sub

YOur help will be appreciated.
 
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
Using macros to find and replace Jan Johansson Microsoft Word Help 3 March 3rd 08 01:55 PM
Find & Replace does not find formatting Mike[_7_] Microsoft Word Help 4 August 30th 07 02:39 PM
Find/Replace formatting Mark Microsoft Word Help 2 March 11th 07 06:24 AM
Using find and replace or macros to replace page ranges JeremyC Microsoft Word Help 7 February 13th 06 09:20 PM
Find & Replace does not find formatting Ed Microsoft Word Help 5 April 1st 05 12:33 AM


All times are GMT +1. The time now is 06:42 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"