Paper Type Codes for Macros

J

Jennifer Q

I would like to create a macro that will quickly assign a paper tray or
paper type to a document.

This is the code:
Sub tray()
With ActiveDocument.PageSetup
..FirstPageTray = wdPrinterManualFeed
..OtherPagesTray = wdPrinterManualFeed
End With
End Sub

But what I am missing are the codes for paper trays besides the Manual Feed.
I would also like to know the code for Letterhead type and Bond type.

Can anyone help out?

Thanks,
Jeni
 
J

Jennifer Q

Also, is it possible to create code like this that can be used for different
sections of a document?


Thanks,
Jennifer
 
O

old man

Hi,

Are you trying to allow the user to enter what section they want to print
and then prompt them with your macro? The way to selectively print sections
in a document with more then one section is to enter(to print section 5 on
page 3) P5S3 in the pages textbox on the print dialog.

old man
 
E

Ed

Hi Jennifer. Hi "old man" :)

Just to add a little to "old man"'s replies ...

Unfortunately, tray IDs can vary from printer to printer (or printer driver
to printer driver). Some drivers seem to use the values "old man" referred to
(the built-in constants such as wdPrinterUpperBin), but some use other values
such as 259.

One way you can tell what IDs are actually in use is to ensure that the
relevant printer is selected in Word, turn on the macro recorder, go into
page setup and select the trays you're interested in. Then stop the recorder
and have a look at the values it recorded.

I've never actually used the paper types listed in the page setup dialog as
"Letterhead" and "Bond" and so on; the way we do it is that we know that
letterhead stationery is in tray one so we find the ID of tray one and use
that for letterhead, and do the same sort of thing for other paper types. I
don't know if this makes a difference.

Regarding your other query, the PageSetup object exists at the level of the
ActiveDocument but also on a section-by-section basis so you can
programmatically control the trays used by different sections of a document.

For example:

With ActiveDocument.Sections(1).PageSetup
.FirstPageTray=wdPrinterUpperBin
.OtherPagesTray=wdPrinterLowerBin
End With

With ActiveDocument.Sections(2).PageSetup
.FirstPageTray=wdPrinterLargeCapacityBin
.OtherPagesTray=wdPrinterLargeCapacityBin
End With

If you have two sections which part-share a page, e.g. a three page document
with a continuous section break on page one and you set section one to go to
tray X and section two to go to tray Y, when I tested this scenario (quite a
while ago) I believe the way that Word handled it was to print page one from
tray X and the other pages from tray Y. (Which was lucky because that's what
I needed:)).

Hope this helps.

Regards.

Ed
 

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