Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2003 Macro - Printing to a specific tray

Status
Not open for further replies.

JEG78

IS-IT--Management
Feb 4, 2004
70
US
Is there a way to use the same macro for different HP Printers to specify a tray to print to. Everyone will be using the same Normal.dot template, but most have a different default printer.

All of my printers are HP LaserJet's. All with the same setup (Envelope Feeder, Tray 1 - Manual Feed, Tray 2, and Tray 3).

I use the following printers: LJ4000, LJ4050, LJ4100, LJ4200, and LJ4250.

Whenever I record the macro, each printer has a different numerical value in the VBA code that represents that specific tray. So, rather than use the numbers, is there another way to specify the tray that would be understood by all of the printers?
 
Here is a macro example:

Sub Print(printer_name As string)
ActivePrinter = printer_name
' printing process
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End Sub


example

call Print("LJ4000")
 
One example from MSDN. Should point you on the correct direction.
OtherPagesTray Property
Applies To

PageSetup object.

Description

Returns or sets the paper tray to be used for all but the first page of a document or section. Read/write Long.

Can be one of the following WdPaperTray constants:

wdPrinterAutomaticSheetFeed
wdPrinterDefaultBin

wdPrinterEnvelopeFeed
wdPrinterFormSource

wdPrinterLargeCapacityBin
wdPrinterLargeFormatBin

wdPrinterLowerBin
wdPrinterManualEnvelopeFeed

wdPrinterManualFeed
wdPrinterMiddleBin

wdPrinterOnlyBin
wdPrinterPaperCassette

wdPrinterSmallFormatBin
wdPrinterTractorFeed

wdPrinterUpperBin





See Also

FirstPageTray property.

Example

This example sets the tray to be used for printing all but the first page of each section in the active document.

ActiveDocument.PageSetup.OtherPagesTray = wdPrinterUpperBin
This example sets the tray to be used for printing all but the first page of each section in the selection.

Selection.PageSetup.OtherPagesTray = wdPrinterLowerBin



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top