Word VBA code no longer changes Printer Tray
Posted on 2009-12-17
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.