Hi,

I have a macro in Word that helps users print to the correct printer tray.
It is basically this:

Sub print_sm(mTray As String, mCopies As Integer)
Options.DefaultTray = mTray
ActiveDocument.PageSetup.FirstPageTray = wdPrinterDefaultBin
ActiveDocument.PageSetup.OtherPagesTray = wdPrinterDefaultBin
For mI = 1 To mCopies
Application.PrintOut Range:=wdPrintAllDocument
Next
End Sub

It worked fine in Word 97, but in 2003 it's rather intermittent. It's as if
the Options.DefaultTray isn't taking sometimes. If I set a breakpoint at the
FirstPageTray line and query the value of Options.DefaultTray, it isn't
always what it should be.

Is there a known reason why this might be? Could I do a workaround along the
lines of:

count=0
while (Options.DefaultTray<>mTray) and (count<100)
Options.DefaultTray=mTray
doevents
count=count+1
wend

Any suggestions gratefully received.

Cheers,

Iain

Re: Options.DefaultTray not sticking by Iain

Iain
Fri Aug 05 02:16:24 CDT 2005

No takers then? :-)

Well, all I can report is that adding the loop (with appropriate warning
message if count>100) seems to have cured the problem.

Strange though....

Cheers,

Iain

"Iain McLaren" <iain.mclaren@scott-moncrieff.moc> wrote in message
news:u$TEid3lFHA.576@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> I have a macro in Word that helps users print to the correct printer tray.
> It is basically this:
>
> Sub print_sm(mTray As String, mCopies As Integer)
> Options.DefaultTray = mTray
> ActiveDocument.PageSetup.FirstPageTray = wdPrinterDefaultBin
> ActiveDocument.PageSetup.OtherPagesTray = wdPrinterDefaultBin
> For mI = 1 To mCopies
> Application.PrintOut Range:=wdPrintAllDocument
> Next
> End Sub
>
> It worked fine in Word 97, but in 2003 it's rather intermittent. It's as
> if the Options.DefaultTray isn't taking sometimes. If I set a breakpoint
> at the FirstPageTray line and query the value of Options.DefaultTray, it
> isn't always what it should be.
>
> Is there a known reason why this might be? Could I do a workaround along
> the lines of:
>
> count=0
> while (Options.DefaultTray<>mTray) and (count<100)
> Options.DefaultTray=mTray
> doevents
> count=count+1
> wend
>
> Any suggestions gratefully received.
>
> Cheers,
>
> Iain
>
>