Hello,
I've a problem with my SetPrinterDuplex function use.
(See http://support.microsoft.com/kb/q230743)
I want to print a file with duplex option.
So, I use the function like this:
SetPrinterDuplex PrinterName, 2
Then I print with printout:
Application.PrintOut Background:=False, Copies:=NumberOfCopies (that is a
var declared upper in my code).
And then, I want to go back to no duplex settings with
SetPrinterDuplex PrinterName, 1
The problem is that the document is not printed on both side.
If I remove the last line, it works fine.
So I suppose my problem occurs because the 2nd setprinterduplex switch the
property too quickly. Is it ?
Does someone have a solution ?
Jonathan West - 04 Jan 2005 11:01 GMT
Hi paschoemans
Take a look at this article
Controlling the Printer from Word VBA
Part 2: Using VBA to control Duplex, Color Mode and Print Quality
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=116

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
> Hello,
>
[quoted text clipped - 21 lines]
>
> Does someone have a solution ?
paschoemans - 05 Jan 2005 12:27 GMT
Thanks for your remark
I've already read your article once.
It was very clear and helpfull.
But I use the code for the microsoft technet article on which is based yours
because I need only to change one property. So it was easier to read.
But I use the same system as you describe for the duplex:
1) change the property to use duplex
2) print with background := False (and a number of copy)
3) go back to the previous setting
And the result is that it's printed only one one side.
But I'm sure that the function to switch the property works fine because if
I remove the 3rd line (go back to previous setting), it's printed on duplex.
Do you see my problem ?
It's probably because the print property is turned back too quickly.
Do you have a solution for me ?
Many thanks
> Hi paschoemans
>
[quoted text clipped - 29 lines]
> >
> > Does someone have a solution ?
Jonathan West - 05 Jan 2005 12:53 GMT
Dealing with printers is always rather flaky and different printers behave
in different ways.
Try including a few DoEvents commands within your macro after the PrintOut
method and before you set the duplex back single-sided.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
> Thanks for your remark
>
[quoted text clipped - 57 lines]
>> >
>> > Does someone have a solution ?
paschoemans - 05 Jan 2005 14:51 GMT
Now it's working according to the events queue flush.
Many thanks and best regards
> Dealing with printers is always rather flaky and different printers behave
> in different ways.
[quoted text clipped - 63 lines]
> >> >
> >> > Does someone have a solution ?
bikuta - 23 Jan 2007 04:46 GMT
Why is there a need for the DoEvents?
>Now it's working according to the events queue flush.
>
[quoted text clipped - 5 lines]
>> >> >
>> >> > Does someone have a solution ?