I am not attempting anything clever here.
Code: Select all
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/30/2023 by Chris077
'
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Body Text")
Selection.Find.ParagraphFormat.Borders.Shadow = False
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("TutBodyText")
Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False
With Selection.Find
.Text = "^p"
.Replacement.Text = "^p"
.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
I opened a second document, it too needed treatment, so I ran the macro from the Normal.dot - but no paragraph styles were changed.
I have since tried using "any character" and "find what text" for the Find .Text and for the Replacement .Text.
I have since tried using paragraph marks "^p" for the Find .Text and for the Replacement .Text.
Why would a simple macro work during recording but not work during playback?
The file in question is attached.
Thanks in advance
Chris