the answer was 257, but why !??

S

scott

hi

I have used Office XP VBA to automated some of our company contract
documents. one of the final steps to the process was making the documents
print to the manual tray 1 of the given printers.

the following snip of code was what I tried first

<snip>

'create contract
Set wdContract = Documents.Add(Template:="G:\contract\docs\contract.dot",
NewTemplate:=False, DocumentType:=0)
'force to print from manual feed tray
wdContract.PageSetup.FirstPageTray = wdPrinterManualFeed
wdContract.PageSetup.OtherPagesTray = wdPrinterManualFeed

</snip>

this was derived from the inline suggestion that the IDE makes ! but upon
running the code, it seemed to ignore this instruction, but no errors were
thrown up.

I then created a new blank doc and used the macro recorder and obtained the
following

<snip>

wdContract.PageSetup.FirstPageTray = 257
wdContract.PageSetup.OtherPagesTray = 257

</snip>

this seems to work completely as expected ! I'm not looking a gift horse
.....etc. etc. etc., but can anyone shed light as to

a) why the first version fails
b) where/what/why this 257 value comes from, and why it works ?


also, one of the documents is an Excel document, the above method only works
for word docs, can anyone point me in the direction of how to code for Tray
1 manual feed for Excel objects ??


thanks


_scott
 
C

Cindy Meister -WordMVP-

Hi Scott,

I'm not an expert on this stuff, but the way I understand it, the Word
constants don't necessarily correspond to what the printer manufacturers
actually use in the printer software. I think you'll find an article on
mvps.org/word about using the Windows API to work with printers, and the
problem is explained in there (even if you're not interested in the code).
Authored by Jonathan West.
I have used Office XP VBA to automated some of our company contract
documents. one of the final steps to the process was making the documents
print to the manual tray 1 of the given printers.

the following snip of code was what I tried first

<snip>

'create contract
Set wdContract = Documents.Add(Template:="G:\contract\docs\contract.dot",
NewTemplate:=False, DocumentType:=0)
'force to print from manual feed tray
wdContract.PageSetup.FirstPageTray = wdPrinterManualFeed
wdContract.PageSetup.OtherPagesTray = wdPrinterManualFeed

</snip>

this was derived from the inline suggestion that the IDE makes ! but upon
running the code, it seemed to ignore this instruction, but no errors were
thrown up.

I then created a new blank doc and used the macro recorder and obtained the
following

<snip>

wdContract.PageSetup.FirstPageTray = 257
wdContract.PageSetup.OtherPagesTray = 257

</snip>

this seems to work completely as expected ! I'm not looking a gift horse
.....etc. etc. etc., but can anyone shed light as to

a) why the first version fails
b) where/what/why this 257 value comes from, and why it works ?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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