Applies to: PrintPreview, IPrinterEx object
  Return Type:   |   Long   | |||
  | ||||
  Parameter(s):   | ||||
   In   |   Optional   |   ReferencePageIndex   |   As   |   Variant   |
Returns the number of pages of a document.
Note:
A report can have more than one document.
If in the middle of the Printing routine there is an EndDoc statement, the Print Preview dialog box will show more than one document. Each document will have its page numbers and page count, and by calling this method it is possible to get the page count of a particular document.
If the ReferencePageIndex parameter is supplied, it will return the page count of the document that the page referenced by ReferencePageIndex belongs. If this parameter is omitted, the current page will be used as the reference.