Common Dialog Printer Box
Hi
I placed a common dialog box in my VB 6 program and in the "Print" command button on my form, I put "CommonDialog1.showprinter" in the Click event with the code for my report immediately following it. I am not using crystal but simply a bunch of Printer.Print, etc statements to make up my report.
It works fine in that it shows the printer dialog box when the user clicks on the Print button but my report prints even if the user click on "Cancel" from the Printer dialog box.
Can you show me how to make the report print only if the user clicks on OK on the printer dialog box?
Thanks,
Re: Common Dialog Printer Box
Try this:
VB Code:
On Error GoTo out
CommonDialog1.CancelError = True
CommonDialog1.ShowPrinter
'do ya thing!!!
Exit Sub
out:
'do nothing
Re: Common Dialog Printer Box
You might want to do something like this.
VB Code:
CommonDialog1.CancelError = True
CommonDialog1.ShowPrinter
'do ya thing!!!
Exit Sub
out:
If Err.Number = 32755 Then
MsgBox "user pressed Cancel"
End If