Options.DefaultTray not sticking

I

Iain McLaren

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
 
I

Iain McLaren

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
 

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