Changing Paper Bins

A typical requirement for office applications is to print the first page of a document with letterhead paper and the remaining pages on plain paper. This is usually done by using a printer that has two separate trays for the two types of paper. The application simply sends the first page to the first paper bin, and then switches to the second bin for the remaining pages.

The printing code from our previous example can be easily extended to achieve this:

[Visual Basic 6]
Printer.PaperBin = vbPRBNLower ' select first tray
For CurPage = 1 To TXTextControl1.CurrentPages
   ' select second tray
   if CurPage = 2 then Printer.PaperBin = vbPRBNUpper
   TXTextControl1.PrintDevice = Printer.hDC
   TXTextControl1.PrintPage CurPage
   If CurPage <> EndPage Then Printer.NewPage
Next CurPage