When I use the Print.KillDoc routine to quit the printing job the application will be hooked. How can I do if I want to cancel the printing job?
Thanks.
did you mean Printer.KillDoc? If so, I use it all the time to kill a document in my error handlers. Are you saying it is making your program stop responding?
Yes, it is a problem of Printer.KillDoc. Even the sample code from VB 6 (listed below) results in the same problem when running the Printer.KillDoc routine. If nothing being printed the KillDoc routine works well otherwise the application will be hooked. I don't know if it is a problem of VB installation. Could you please try the code and see what happens on your machine?
Thanks very much for your help.
-----------------------------------------------
'adopted from VB 6 help of KillDoc
For i = 1 To 40
Printer.CurrentX = 1440 ' Set left margin.
Printer.CurrentY = (i * 300) ' Advance page to next line.
Printer.Print "This is line" & Str$(i) & " of text."
On Error Resume Next ' Catch any printer error.
If i = 26 Then
Printer.KillDoc ' Terminate print job abruptly.
Printer.EndDoc
End
End If
Next i
-----------------------------------------------
Yes, it is a problem of Printer.KillDoc. Even the sample code from VB 6 (listed below) results in the same problem when running the Printer.KillDoc routine. If nothing being printed the KillDoc routine works well otherwise the application will be hooked. I don't know if it is a problem of VB installation. Could you please try the code and see what happens on your machine?
Thanks very much for your help.
-----------------------------------------------
'adopted from VB 6 help of KillDoc
For i = 1 To 40
Printer.CurrentX = 1440 ' Set left margin.
Printer.CurrentY = (i * 300) ' Advance page to next line.
Printer.Print "This is line" & Str$(i) & " of text."
On Error Resume Next ' Catch any printer error.
If i = 26 Then
Printer.KillDoc ' Terminate print job abruptly.
Printer.EndDoc
End
End If
Next i
-----------------------------------------------
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.