To add page numbers to the printed output of an existing form (in either the header or footer area), take advantage of the "Printing page" command and the "On Header" or "On Printing Footer" event.
First, to gain access to the header or footer areas, turn on the markers in the form. Right- or cmd-click (Mac OS X) the form to get the context menu, and select both "Markers" and "Marker Labels" to turn them on.
Then use the markers to create a space on the printed page for the page number. Grab the desired marker (header or footer) by its label, and drag it to leave enough space to place a variable. Now create a variable of type Alpha in the header or footer area.
Next make sure the variable object method triggers during the "On Header" or "On Printing Footer" event. Right- or cmd-click (Mac OS X) on the variable to open the Property List, and under the Events theme, select either "On Header" or "On Printing Footer", depending on whether you want to print page numbers in the header or the footer.
Finally, write the simple code that will execute when the event fires. Right- or cmd-click (Mac OS X) the variable and select the Object Method. To print "Page 1", "Page 2", etc., use the code:
vPageNum := "Page " + String(Printing page)
Now the printed output will have page numbering: