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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem of Cancel Printing

Status
Not open for further replies.

wangsx

Programmer
Mar 17, 2004
11
CA
Hi,

When I cancel the print job by using Printer.KillDoc and Printer.EndDoc the program will lock up. How can I solve the problem? Thanks.

Shouxi Wang
 

Perhaps you should read FAQ222-2244 first and then restate your question with a little more detail so we know what steps are happening prior to your problem.

Good Luck

 
Thanks for your suggestion.
Following code will help me to state the question. After printing something a message box will be shown asking if continue the printing. There is no problem for vbOK button (Continue the printing). But if I want to cancel the printing job and select vbCancel the program will be locked (hooked).

----------------------------------------------------
Printer.Print "Title"
prompt$ = "Print to " & Printer.DeviceName & "?"
answer = MsgBox(prompt$, vbOKCancel, "Print")
If answer = vbOK Then
Printer.EndDoc
Else 'following code causes the problem
Printer.KillDoc
Printer.EndDoc
End If
 

Well looking at the help files shows the same thing so it is not that much help at the moment. Have you walked/stepped through the code? I am betting that the reason vb seems to lock up is because of its communication with the printer and clearing the buffer of the data sent to it.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top