--- In [email protected], "Ulrike Haupt" <[EMAIL PROTECTED]> wrote:
> Hi friends
>
> I have an application where the contents of rtfbox is being
printed. How can
> I stop that an empty page is printed afterwards?
>
> the code of the 'print' button is:
> CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums
> If RichTextBox1.SelLength = 0 Then
> CommonDialog1.Flags = CommonDialog1.Flags + cdlPDAllPages
> Else
> CommonDialog1.Flags = CommonDialog1.Flags + cdlPDSelection
> End If
> CommonDialog1.ShowPrinter
> Printer.Print ""
> RichTextBox1.SelPrint CommonDialog1.hDC
> Printer.EndDoc
>
> When I don't use the last line in this sub, the extra blank page is
printed
> when the program exits. As it is the extra blank page prints
immediately.
First of all, I got to tell you that I have never really used
the printer dialog box. I always use printer.print but it just goes
to the default printer that way, and I don't recall any funky page
feed problems. Could it be that this sub is not what is causing the
extra page to be printed? The EndDoc, I am guessing, basically tells
the printer that that's the end of the data and to go ahead and
formfeed. I have never used it myself.
When you say the page feeds immediately with the printer.enddoc,
does it only feed once, or does it feed twice, where without that
line it might only feed once?
Have you tried something along the lines of
If richtextbox1.sellength=0 then
printer.print richtextbox1.text
else
printer.print richtextbox1.selected
end if
[C]
'// =======================================================
Rules : http://ReliableAnswers.com/List/Rules.asp
Home : http://groups.yahoo.com/group/vbHelp/
=======================================================
Post : [email protected]
Join : [EMAIL PROTECTED]
Leave : [EMAIL PROTECTED]
'// =======================================================
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/vbhelp/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/