lastPage

Set the last page to print.
[read/write property] lastPage([out, retval] int *page) lastPage([in] int page)
This property sets the last page to print, and firstPage sets the first page to print.

This is a simplified form of the pages property. If the pages property is set, the values of firstPage and lastPage will be ignored.

resetParams resets this to its default value, which is to end with the last page of the document.

VB:
pdf.firstPage = 10 pdf.lastPage = 20
firstPage
pages
resetParams