How to select – or set a Range object – to the page that the cursor is on

Article contributed by Bill Coan

To select the page the cursor is in

Selection.GoTo What:=wdGoToBookmark, Name:="\page"

To set a range object to the page the cursor is in:

Dim MyRange As Range
Set MyRange = Selection.Range
Set MyRange = MyRange.GoTo(What:=wdGoToBookmark, Name:="\page")
'you can then operate on the page without selecting it, e.g.
MyRange.Delete

To set a range object to the page the range is currently in:

'Having previously set the MyRange variable to a range somewhere ...
Set MyRange = MyRange.GoTo(What:=wdGoToBookmark, Name:="\page")
'you can then operate on the page without selecting it, e.g.
MyRange.Delete

To set a range object to a particular page number:

Dim MyRange As Range
Set MyRange = ActiveDocument.Range(0,0)
Set MyRange = MyRange.GoTo(What:=wdGoToPage, Name:="4")
Set MyRange = MyRange.GoTo(What:=wdGoToBookmark, Name:="\page")
'you can then operate on the page without selecting it, e.g.
MyRange.Delete