Link to home
Start Free TrialLog in
Avatar of BigWill5112
BigWill5112

asked on

Extend selectin to beginnig of document.

Can someone tell me why this code does not keep selected the page that contains "secondary".  Should be easy to tell what I am tryign to do.  I want to find the page that contains "secondary" and then select that page and everything else before it.  Instead it is selecting all pages before the one that contains "secondary"
Sub Macro1()
'
' Macro1 Macro
'
'
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "secondary"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
ActiveDocument.Bookmarks("\Page").Range.Select
Selection.HomeKey wdStory, wdExtend



End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of pteranodon72
pteranodon72
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial