Also, I tried to specify Pages:="1" and Pages:="2", but that didn't
work. It printed the whole file, so I had to go with specifying
Range, From and To. Am I missing something?
thanks
-------------------------
Sub MyPrint()
'
' MyPrint Macro
'
Application.ActivePrinter = "hp deskjet 5800 series"
Options.DefaultTrayID = wdPrinterUpperBin
ActiveDocument.PrintOut Background:=True, Range:=wdPrintFromTo,
From:="1", To:="1", Copies:=2
Options.DefaultTrayID = wdPrinterLowerBin
ActiveDocument.PrintOut Background:=True, Range:=wdPrintFromTo,
From:="2", To:="2", Copies:=1
End Sub
Try changing "Background:=True" to "Background:=False".
HTH + Cheers - Peter
Word's help and the VBA constants for paper trays are thoroughly misleading.
Take a look here for an article that helps straighten it all out.
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
http://www.multilinker.com
Please reply to the newsgroup
"Peter Kronenberg" <pak@nospam_carouselpuppets.com> wrote in message
news:nqsna09219cicsejg...@4ax.com...
OK, in that case, instead of setting the Options.DefaultTrayID, set the
trays for the document, like this
Sub MyPrint()
'
' MyPrint Macro
'
Application.ActivePrinter = "hp deskjet 5800 series"
ActiveDocument.PageSetup.FirstPageTray = wdPrinterUpperBin
ActiveDocument.PrintOut Background:=True, Range:=wdPrintFromTo,
From:="1", To:="1", Copies:=2
ActiveDocument.PageSetup.PtherPagesTray = wdPrinterLowerBin
ActiveDocument.PrintOut Background:=True, Range:=wdPrintFromTo,
From:="2", To:="2", Copies:=1
End Sub
Try setting the bottom tray using the Page Setup dialog. Then check the
value of the OtherPagesTray property from the immediate window. Then put
that value into your code.
>
>"Peter Kronenberg" <pak@nospam_carouselpuppets.com> wrote in message
>news:nvsra0h2qv2kp5fus...@4ax.com...
>> Still no luck. I have tried every combination I can think of but just
>> can't get it to print from the bottom tray. I tried commenting out
>> the first PrintOut command, so that it just prints the 2nd page from
>> the bottom tray, but it prints to the upper tray.
>
>Try setting the bottom tray using the Page Setup dialog. Then check the
>value of the OtherPagesTray property from the immediate window. Then put
>that value into your code.
Hi,
Not sure what you mean by checking the value from the immediate
window.
thanks,
Peter
- Open the document.
- Using the Page Setup dialog, set the trays as you wish them to be
- Open the VBA editor.
- Press Ctrl-G to display the Immediate window
- In the immediate window, type the following (including the initial
question mark) and press enter
? ActiveDocument.PageSetup.FirstPageTray
This will give you th code value for that tray, which you should put into
your code.
Similarly, for the second tray, type the following
? ActiveDocument.PageSetup.OtherPagesTray
I have got round this by using first page tray and other pages tray
properties in document page setup. This might not be suitable for you as
you need to alter the page setup of the document or the template, but it
might point you in another direction.
Sub trayshow()
MsgBox "first page tray", vbOKCancel, ActiveDocument.PageSetup.FirstPageTray
MsgBox "rest of pages trays", vbOKCancel,
ActiveDocument.PageSetup.OtherPagesTray
End Sub
this gives code numbers for the pages that you can use within your code to
set the tray to print to
you can set these numbers with code
such as
ActiveDocument.PageSetup.FirstPageTray = 258
ActiveDocument.PageSetup.OtherPagesTray = 257
then just print it out
ActiveDocument.PrintOut
Hope this helps
Yours Kriss
"Peter Kronenberg" <pak@nospam_carouselpuppets.com> wrote in message
news:nqsna09219cicsejg...@4ax.com...