Vba – Word Macro for other tray printing

ms-wordprintingvba

For years our office has been using HP printers and a few Macros in MS Word that add buttons to the toolbar. One prints the job to tray 3 (plain paper), one prints the first page to tray 2 (pre-printed letterhead) and the rest to tray 3, and the last sends the whole job to tray 1 (manual feed for labels etc.).

This has all been pretty straight cut to tweak if the printer changed, but now we have replaced all of those HP printers with Canon printers and are using the UFRII drivers…

The macro sort of works, but not quite.
The issue is that previously the tray assignments were set with the tray numbers
eg.

Sub Letterhead()
'
' Prints the Letterhead copy of documents (First page LH, balance on Plain)
' Created By Reece on 24/01/2011
'
    With ActiveDocument.PageSetup
        .FirstPageTray = 263
        .OtherPagesTray = 262
    End With

    Application.PrintOut , Range:=wdPrintAllDocument

    With ActiveDocument.PageSetup
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin

    End With
End Sub

but now the tray assignments are using what I've got below:

Sub Letterhead()
'
' Prints the Letterhead copy of documents (First page LH, balance on Plain)
' Created By Reece on 08/05/2013
'
    With ActiveDocument.PageSetup
        .FirstPageTray = wdPrinterUpperBin
        .OtherPagesTray = wdPrinterMiddleBin
    End With

    Application.PrintOut , Range:=wdPrintAllDocument

    With ActiveDocument.PageSetup
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin

    End With
End Sub

Usually, all I'd have to do to find out the new printer's tray numbers is record the macro by running through the procedue (page layout > change trays > print > change trays back) and taking note of the numbers… but I'm not getting numbers with the new printers.

Can anyone help find what the tray assignment numbers are for Canon LBP6680's?

Best Answer

Don't worry, these are Visual Basic constants, which actually are numbers as well. You don't have to buy some commercial product.

In Word, use the Alt-F11 key combo to open the VBA editor. In the editor, use F2 to open Objectenoverzicht (I have a Dutch version of Word, maybe this is called "Object view" or something). Near the top in the right pane are two drop down list boxes. Type one of the constants, say wdPrinterUpperBin, in the lower box and hit the button with the binocular. A pane opens on the right below that lists all possible terms. When you select one of these, the corresponding number is given in a section below the pane.

Kind regards,

Coos

Related Topic