Printing repeat pages from two trays, etc

T

Tony Molloy

We print a lot of client letters with a file copy. The first page of the
client copy has to come out on headed (always in tray 3) and any subsequent
pages on plain (always in tray 2), the file copy is all on plain. The
printer is a HP LJ 2430 using the PCl5 drivers. I've used print sets to
create a letterhead set and a plain set, but it's a bit complicated having to
remember how to use these and people still get it mixed up. I'd like to set
up a macro/VBA which will print two copies of page 1, one on letterhead and
one on plain and then two copies of any subsequent pages on plain. We're
using Word 2000. I've also got a HP LJ 2300 which is an alternative printer
so it would useful if the macro/VBA could support this model as well. I've
got no expertise with macros/VBA, so could some kind person point me in the
right direction please?

Thanks

Tony
 
G

Graham Mayor

Without having your printer(s) available to check - something along the
lines of

Sub PrintCopies()
Dim sTray As String
sTray = Options.DefaultTray
Options.DefaultTray = "Tray 3"
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="1",
Copies:=1
Options.DefaultTray = "Tray 2"
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="1",
Copies:=1
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="2-99",
Copies:=2
Options.DefaultTray = sTray
End Sub

should do the trick. See also http://www.gmayor.com/fax_from_word.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
T

Tony Molloy

Thanks Graham,

I've been trying this out on my local network printer (a HP LJ1320) just to
test it out, but it won't select Tray 3, it only uses Tray 2. The multiple
page copies work OK, etc. I've tried using the different IDs for the tray,
e.g Tray3, Letterhead, 258 but it still won't select it. I've tried
recording macros of setting the tray, etc, just to check that names used in
the macro match what I've been sending and they do.

Any thoughts on what I'm doing wrong please?

Tony
 
J

Jonathan West

Tony Molloy said:
Thanks Graham,

I've been trying this out on my local network printer (a HP LJ1320) just
to
test it out, but it won't select Tray 3, it only uses Tray 2. The
multiple
page copies work OK, etc. I've tried using the different IDs for the
tray,
e.g Tray3, Letterhead, 258 but it still won't select it. I've tried
recording macros of setting the tray, etc, just to check that names used
in
the macro match what I've been sending and they do.

Any thoughts on what I'm doing wrong please?

It's mostly the fault of Microsoft and the printer manufacturers between
them.

First, I would recommend that you apply the FirstPageTray and OtherPagesTray
properties to the document itself in order to get it to print right, rather
than relying on the DefaultTray property to stick between printings during a
macro. Especially as you are doing background printing (or at least, there
is nothing showing that you are forcing a print in the foreground), changing
the default tray on the printer while it is printing usually just has no
effect.

Second, as the FirstPageTray and OtherPagesTray properties are the tray ID
numbers, not the tray names, you need to find out what those numbers are.
This is where you start complaining bitterly at Microsoft and wishing their
right and left hands could have a passing acquaintance with each other.

The tray IDs vary between different printers. They even vary (as I have
discovered to my profound despair) on the *same* printer (HP models are
particular culprits) depending whether you use the postscript or the PCL
driver. In any case, the tray ID numbers almost never match the built-in
constants in the Word object model.

To find out that the Tray IDs really are, take a look at this article.

Controlling the Printer from Word VBA
Part 1: Using VBA to Select the Paper Tray
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top