View Single Post
 
Old 04-11-2023, 11:31 AM
ctviggen ctviggen is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Feb 2021
Posts: 54
ctviggen is on a distinguished road
Default

Not directly related, but why can you also put the execute replace statement outside the with...end with "loop"?



In other words, this:


Code:
Sub Macro1()     With Selection.Find         .ClearFormatting         .Replacement.ClearFormatting         .Text = "^13{2,}"         .Replacement.Text = "^p^p"         .Forward = True         .Wrap = wdFindContinue         .Format = False         .MatchCase = False         .MatchWholeWord = False         .MatchAllWordForms = False         .MatchSoundsLike = False         .MatchWildcards = True         ' .Execute Replace:=wdReplaceAll     End With
    Selection.Find.Execute Replace:=wdReplaceAll End Sub

Does the Selection.Find just find everything...but do nothing until the execute? If so, why don't you HAVE to put the replace all outside the loop?
Reply With Quote