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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

USE VB to control printing pages from Word to specific trays?

Status
Not open for further replies.

Centerfuge

Programmer
Mar 3, 2003
17
US
Hi guys, big problem here. I have to write a script to process through a bunch of word documents, open them up and then print them. The problem is that I need page one to go to one paper tray, page two to go to a different paper tray, and so on.

The user doesn't need to see the documents, I know how to open the word documents within VB, but I don't know how to just select a specific page and then tell that page to print to a specific tray. Any help would be greatly appreciated, as I am seriously under the gun here.
 
Well... I figured it out on my own. Atleast a work around for it (kind of a 'brute force' and inelegant way of doing it). Thanks anyway.
 
Just a thought (since you figured it out) you could use devmode/printer_info2 to set the trays. Just a thought.

Thanks,
James
[shadeshappy] [evil]
"Make it idiot-proof and someone will make a better idiot." ~bumper sticker
 
i = LBound(fileName)
Do While i < UBound(fileName)
Set doc1 = Word.Documents.Open(App.Path & &quot;\&quot; & fileName(i) & &quot;.doc&quot;)
With doc1
Printer.PaperBin = 1
doc1.PageSetup.FirstPageTray = 1
doc1.PageSetup.OtherPagesTray = 1

doc1.PrintOut False, False, wdPrintRangeOfPages, , , , , , &quot;2&quot;

doc1.PageSetup.FirstPageTray = 3
doc1.PageSetup.OtherPagesTray = 3

doc1.PrintOut False, True, wdPrintRangeOfPages, , , , , , &quot;3&quot;

End With
doc1.Close
i = i + 1
Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top