PDA

View Full Version : VBA Printing - Overriding Some Printer Default Trays



jamieleeuk
02-17-2009, 05:22 AM
I have a custom button in a custom toolbar which works fine how it's supposed to - ie, prints the active document twice, but page one of the first copy is to come from tray 1, the subsequent pages of the first copy is to come from tray 3 and the second copy is to come wholly from tray 2.
This gives me a Letterheaded first page, subsequent plain white paper pages and then a blue file copy.

This is done by using the following code:



Dim OriginalFirstPageSetting As Long, OriginalOtherPageSetting As Long
With ActiveDocument.PageSetup
OriginalFirstPageSetting = .FirstPageTray
OriginalOtherPagesSetting = .OtherPagesTray

.FirstPageTray = 1
.OtherPagesTray = 3

ActiveDocument.PrintOut

.FirstPageTray = 2
.OtherPagesTray = 2

ActiveDocument.PrintOut


.FirstPageTray = OriginalFirstPageSetting
.OtherPagesTray = OriginalOtherPagesSetting

End With
End Sub


I have a problem though - although mine works fine, it has a tendancy to play silly buggers on other machines. IE, If I use the button and then print from anywhere else, the doc comes out on plain white paper (tray 3) which is correct, but, if someone else used the above button, it would print out the active documents fine as they want, but then any subsequent prints they performed from any other application comes out of the wrong tray.

IE

They were printing outlook emails from tray 3 by default, then, after using my button, the emails were coming from tray 2!

I have set their printers both in the properties AND in the printer physical settings to default to tray 3, but to no avail.

I'm wondering whether having 2 people sharing the same printer would have any bearing on this?

Thanks