I'm trying to get vba code that I can use to specify which printer bin is used for printing (to get some things to print on headed paper). When I'm printing a report I've been using the code below (called from a button using Call PrintPages(Me.cboReportList, Me.cboFirstPage)). I've tested all the possible Access constants on the relevant printer and they all printed out via the default tray (i.e. don't seem to be understood), except the Cassette constant which worked. On another printer I got the middle tray working using the Upper tray constant! Is there any way to use these constants in a less hit and miss way?
Then I found code of how to find what bins (names & numbers) are available on a certain machine. This returned a list of about 25 bins for my main printer, with numbers from 15 to 1257. I don't undestand how to use these. Are they perhaps for use when controlling the printing of a Word document rather than an Access report?
Private Sub PrintPages(strReport As String, _
PaperBin As AcPrintPaperBin)
Dim rpt As Report
On Error GoTo HandleErrors
DoCmd.OpenReport strReport, acViewPreview, WindowMode:=acIcon
Set rpt = Reports(strReport)
rpt.Printer.PaperBin = PaperBin
' Unfortunately, you have to select the
' report in order to print it. Who wrote
' the PrintOut method this way, anyway?
DoCmd.SelectObject acReport, strReport
DoCmd.PrintOut acPages, 1, 1
DoCmd.Close acReport, strReport, acSaveNo
MsgBox "Error: " & Err.Description & " (" & Err.Number & ")"