Printer.print issue (VB 6)

Hi ,

First of all, I have Microsoft Office Document Image Writer is as the default printer in winxp.
when I tried the following VB code, it opens the SaveAs dialog box to save it to the file


Private Sub Form_Load()

Dim lngError As Long

Dim strError As String

Dim temp As Variant

On Error GoTo ERROR_Handler



Printer.Print "Dh"

Printer.Print "Mi"

Printer.Print "Hi"

Printer.EndDoc



Exit Sub



ERROR_Handler:

lngError = Err.Number

strError = Err.Description

MsgBox (Str(lngError) + " " + strError)

End Sub



Now, if I click on save button it executes smoothly, but if I click on cancel button it gives me the error "482 Printer error".
Now what i want to do is, it should not give me the error when i press "Cancel" button to cancel the print job.
But if i have no printer configured on my machine then it should give me the specific error like "Printer is not installed/configured on your machine".
So, please let me know how I can handle different behaviour(as stated above) using Printer.print command.



Thanks,

DhavaL
[1268 byte] By [dhaval939] at [2007-11-19 23:56:07]