Access 2003 Printer Settings

C

Cheval

I'm trying to set the printer, paper size and source tray via vba code.

I can set the Printer using the following code


Dim p As Printer
For Each p In Application.Printers
If (StrComp(sPrinter, p.DeviceName, vbTextCompare) = 0) Then
Application.Printer = p
SetPrinter = True
Exit For
End If
Next p

Though, when I set the PaperBin to anything, no matter which printer I have,
it sets it to the first tray only. Should the command
"application.Printer.PaperBin = acPRBNManual" actually work?

I've also used the Windows API's to get the printers trays and tray ID's,
but apparently Access 2003 SP1 can't set a tray ID to anything above 256. eg.
"application.printer.paperbin = 257" equals an error.

So does anyone know how, via code, can I set the printer, tray and size?
 
Top