Reputation: 67
https://stackoverflow.com/a/11624006/1553562
How do i limit my search to a limited range of documents taken as input from the user???
Upvotes: 1
Views: 1829
Reputation: 149277
This will let you specify your range from Page 3 to Page 20
Sub Sample()
Dim rng As Range
Dim StartPage As Long, EndPage As Long
StartPage = 3: EndPage = 20
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=StartPage
Set rng = Selection.Range
Selection.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=EndPage
rng.End = Selection.Bookmarks("\Page").Range.End
'~~> Now you have got your range. Do the necessary action here
With rng
End With
End Sub
Upvotes: 3