Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showprinter common dialog box still prints though cancel is pressed 1

Status
Not open for further replies.

229257

Programmer
Apr 23, 2002
54
GB
In my latest project i have a print routine in which i use the .showprinter common dialog box.

The only trouble is if the user pushes the cancel button on the .showprinter dialog box it will still print!

I have tried the following line without any success:

If cdbPrint.CancelError = True Then
Exit Sub
End If

Any suggestions would be greatly appreciated.


229257
 
Well, in most cases, my experience has shown that if it is a sitem being printed, you will not be able to stop it using code, or possibly not at all. This is due to the current speed and size of the spoolers today. When you click print, the system dumps the file to the printer and it will print it no matter what. You may be able to change your spool settings. Someone may have found a way to beat the clock per se, but it usually doesn't work.
 

Give this a try...
[tt]
Private Sub PrintStuff()

On Error GoTo PrintStuffError

CD.CancelError = True

CD.ShowPrinter
'do stuff

Exit Sub
PrintStuffError:

If Err.Number = 32755 Then Exit Sub 'user pressed cancel

End Sub
[/tt]

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top