See Also Example
Applies To
Printer object.
Description
Specifies the current page number. Not available at design time and read-only at run time.
Usage
Printer.Page
Remarks
Visual Basic keeps a count of pages that have been printed since your application started or since the last Printer.EndDoc statement was executed. This count starts at one and increases by one if:
You use the NewPage method.
You use the Print method and the text you wish to print does not fit on the current page.
Note Graphics methods output that does not fit on the page does not generate a new page. The output is clipped to fit the page's printable area.
Data Type
Integer
Help:
EndDoc Method
NewPage Method
Print Method
Programmer's Guide:
Chapter 16, "Displaying and Printing Information"
The example prints three pages of text with the current page number at the top. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim Header, I, Y ' Declare variables.
Print "Now printing..." ' Put notice on form.
Header = "Printing Demo - Page " ' Set header string.
For I = 1 To 3
Printer.Print Header; ' Print header.
Printer.Print Printer.Page ' Print page number.
Y = Printer.CurrentY + 10 ' Set position for line.
' Draw a line across page.
Printer.Line (0, Y) - (Printer.ScaleWidth, Y) ' Draw line.
For K = 1 To 50
Printer.Print String(K, " "); ' Print string of spaces.
Printer.Print "Visual Basic "; ' Print text.
Printer.Print Printer.Page ' Print page number.
Next
Printer.NewPage
Next I
Printer.EndDoc
End
End Sub