Word Macro Function Finds All Not Selection

I'm not well versed in Word Macros, but trying a simple With Selection.Find step (see 2nd section below).  Instead of replacing paragraph breaks with manual line breakas IN THE SELECTION ONLY, it does the replace throughout the entire docuemnt.  Even when I changed it to replaceselection instead of replaceAll it still replaced throughout the document.  Not sure if it is because after I did a Find to get the selection, I narrowed the selection by a couple of words (see first section below).  Thank you.

    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "63.^t*65.^t"
        .Replacement.Text = "^l"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute
    Selection.MoveLeft Unit:=wdWord, Count:=7, Extend:=wdExtend
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
   
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "^p"
        .Replacement.Text = "^l"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceSelection
LVL 2
rvfowler2Asked:
Who is Participating?
 
Rgonzo1971Commented:
HI,

pls try to change  .Wrap to

        .Wrap = wdFindStop

Regards
0
 
rvfowler2Author Commented:
The above works just put the last line back from WdReplaceSelection to WdReplaceAll.  Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.