B
Bob Wickham
Hi,
I have recorded a macro that searches a document for Normal style and
changes it to Body Text + Justified Style.
It works perfectly while I'm recording it, but it wont work at all after
that.
For instance, before I started recording I manually changed the text to
Normal style, then I recorded the macro that changed it to Body Text +
Justified.
To test it after recording I manually changed the text to Normal style
again. I then ran the macro, but nothing happens
Sub Macro12()
'
' Macro12 Macro
' Macro recorded 23/03/2007 by Bob
'
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Normal")
Selection.Find.ParagraphFormat.Borders.Shadow = False
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("Body Text")
With Selection.Find.Replacement.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
.Alignment = wdAlignParagraphJustify
End With
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
Am I missing the point here or is there something more sinister at work.
Thanks
Bob
I have recorded a macro that searches a document for Normal style and
changes it to Body Text + Justified Style.
It works perfectly while I'm recording it, but it wont work at all after
that.
For instance, before I started recording I manually changed the text to
Normal style, then I recorded the macro that changed it to Body Text +
Justified.
To test it after recording I manually changed the text to Normal style
again. I then ran the macro, but nothing happens
Sub Macro12()
'
' Macro12 Macro
' Macro recorded 23/03/2007 by Bob
'
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Normal")
Selection.Find.ParagraphFormat.Borders.Shadow = False
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("Body Text")
With Selection.Find.Replacement.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
.Alignment = wdAlignParagraphJustify
End With
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
Am I missing the point here or is there something more sinister at work.
Thanks
Bob