Word VBA code no longer changes Printer Tray

Posted on 2009-12-17
Last Modified: 2012-05-08
For years we have been using VBA code such as:

      Options.DefaultTray = "Tray 2"

to change the printer tray so that users can print on different paper types. (The tray description varies from printer to printer, but the method is the same.)

This has worked on various printers (e.g. HP LaserJet 5, Dell 5100 colour), but not on a HP 4700 colour.

We have upgraded from MS Office 2000 / Windows 2000 to MS Office 2007 / Windows XP, and now none of the printers will change tray. If exactly the same code is sent to a printer from (1) Word 2000 / Win2k and (2) Word 2007 / XP, then (1) still works as before, but (2) does not. This suggests that the problem cannot be due to settings made on the printer's control panel, as these would apply in each case. In addition, the problem with the HP 4700 colour occurred before the upgrade to Word 2007 / XP, so if the problem is the same (as the symptoms are), it is difficult to see a common factor.

All printers are networked and the drivers / queues are assigned from a central print server running Windows 2003 server

Has anyone met this issue and found a solution?

I have also tried sending the tray's ID number instead of its text description, e.g.

      Options.DefaultTrayID = wdPrinterUpperBin

or changing the Tray settings in Page Setup for the active document, e.g.

      ActiveDocument.PageSetup.FirstPageTray = wdPrinterLowerBin

instead of changing the Default Tray. Neither of these approaches worked either.
Question by:PKFIOM
    LVL 76

    Expert Comment

    I don't have a multi-tray printer to try it, but Allen Wyatt's site is usually reliable and comprehensive. Here is his article on the subject, which he says applies to all versions from 97 to 2007.
    LVL 37

    Accepted Solution

    I ran across this problem too and had to record a macro to ascertain the proper names by selecting the various paper trays.  The names had changed dramatically from the normal wdPrinterLowerBin to bin names such as "260."


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    When I recently replaced my image transfer kit on my office HP color laserjet 5550dn printer, I had a slight problem.  The left bracket that holds the transfer kit got stuck in the upright locked position instead of being at a 45 degree angle facing…
    Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
    In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
    This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now