Printer error 482

Hi ,

I've got problems with HP printers...series 400, 500, 600 and 700.
Every time somebody with that kind of printer clicks the 'Print' command
in my program they get a runtime 482.

Unlike the descriptions in 'Help' my guess is that error 482 is a VB message
reporting a bad error code from the printer driver.
How can I trap this error? Can I bypass it an still be able to print?

There are no problems whatsoever with any other printers, but it's absolute
unacceptable my program can't be used by people who own a HP printer...

Ok, this is my print code:

Private Sub cmdPrintSelected_Click()

CommonDialog1.CancelError = True


'give the user a chance to halt the printjob
Dim msg As String
Dim X As Integer
msg = "You're about to print a full page sample of every font you selected. Continue?"
X = MsgBox(msg, 33, "Info")
If X = 2 Then    'do nothing
    'go ahead...
    CommonDialog1.DialogTitle = "Select a printer"
    CommonDialog1.Flags = &H100&
    '...and print
    Dim numitm
    Dim i As Integer
    numitm = listfonts.ListCount
    For i = 0 To numitm - 1
        If listfonts.Selected(i) Then
        'create left margin
        Printer.ScaleLeft = -500
        Printer.CurrentX = 0
        Printer.Print ""
        Printer.Print ""
        Printer.Font.Name = "Arial"
        Printer.Font.Size = 14
        Printer.Font.Bold = True
        Printer.Font.Italic = False
        Printer.Font.Underline = False
        Printer.Print "Sample of "; listfonts.List(i)
        Printer.Print ""
        Printer.Font.Size = 12
        Printer.Font.Italic = True
        Printer.Print "Size"
        Printer.Font.Name = listfonts.List(i)
        Printer.Font.Size = 6
        Printer.Font.Bold = False
        Printer.Font.Italic = False
        Printer.Print "6-point type, quite small, but readable for most people."
        Printer.Font.Size = 10
        Printer.Print "10-point type, often used for body text."
        Printer.Font.Size = 12
        Printer.Print "12-point type, easy-to-read-size."
        Printer.Font.Size = 14
        Printer.Print "14-point type, ideal for subheads."
        Printer.Font.Size = 18
        Printer.Print "18-point type is for emphasis."
        Printer.Font.Size = 24
        Printer.Print "24-point type makes headlines."
        Printer.Font.Size = 36
        Printer.Print "36-point type: impact."
        Printer.Font.Size = 60
        Printer.Print "60-point type!"
        Printer.Font.Name = "Arial"
        Printer.Font.Size = 12
        Printer.Font.Italic = True
        Printer.Font.Bold = True
        Printer.Print "Style"
        Printer.Font.Name = listfonts.List(i)
        Printer.Font.Bold = False
        Printer.Font.Italic = False
        Printer.Print "This is a normal weight type, suitable for most purposes."
        Printer.Font.Bold = True
        Printer.Print "This is a boldfaced type, ideal for emphasis or headings."
        Printer.Font.Bold = False
        Printer.Font.Italic = True
        Printer.Print "This is an italic (or oblique) type, used for emphasis."
        Printer.Font.Bold = True
        Printer.Print "This is a bold, italic type, combining both emphasis techniques."
        Printer.Font.Bold = False
        Printer.Font.Italic = False
        Printer.Font.Underline = True
        Printer.Print "This is a normal, underlined type."
        Printer.Font.Underline = False
        Printer.Print ""
        Printer.Font.Name = "Arial"
        Printer.Font.Size = 12
        Printer.Font.Italic = True
        Printer.Font.Bold = True
        Printer.Print "Characters"
        Printer.Font.Name = listfonts.List(i)
        Printer.Font.Size = 14
        Printer.Font.Bold = False
        Printer.Font.Italic = False
        Printer.Print "abcdefghijklmnopqrstuvwxyz"
        Dim char As String
        char = "²&é(§è!çà)-^$ùµ<,;:=³1234567890°_¨*%£>?./+|@#^{}[]´`\~"
        Printer.Print char
        Printer.EndDoc  'that's all
        End If

End If

Exit Sub
Select Case Err.Number
    Case 32755  'cancel error
    'do nothing
    Case Else   'anything else
    MsgBox "An Error was generated:" & vbCrLf & "Description: Error" & Str(Err.Number) & " - " & Err.Description & vbCrLf & vbCrLf & "Please inform the author with the error description above.", , "Error", Err.HelpFile, Err.HelpContext
End Select

End Sub

Thank you,

Who is Participating?
fguerreiro_inixConnect With a Mentor Commented:
Bypass the error.

If error is 482 and the printer is one of that kind, bypass it.
(but only in these conditions)

Hope this helps
What version of VB? What line of Code do you get the error on?
Error 482 is generic "printer error".  when does this pop up? What is status of printer? Does ANYTHING print? Have you single stepped thru this code?

Couple of general comments. Move the DIM CHAR out of the loop so it only runs once. Minimum font size is *8*, windows/VB has trouble rendering below 8 so that could be cause if program is stopping on or about that line. Put var name on Next (I know is not required but is cleaner)

I've found certain driver errors with the hp printer drivers, not relating to this problem, but with them rendering open circles and boxes as filled. Don't know it it's related or not.

dvbasicAuthor Commented:
Combining both answers:

I'm using VB5 (bought VB6 just now, not installed yet)

I' can't reproduce the error at my home. The errors were reported to me.
I can of coarse reproduce the error by a err.raise in VB, but I wouldn't know where, and how to still get the printing done...

I've got two descriptions of when the error occurs:
In one case, the print dialog comes up, and after setting how many copies and the print range, this user got no response from his printer (nothing happened).
Ater closing the program and open it again, the printer error 482 message came up.

In THAT code (at loading time) I merely do a :

For i = 0 To Printer.FontCount - 1      'get all printerfonts
    teller = i + 1
    formstart.lblCount = teller
    listfonts.AddItem Printer.Fonts(i)  'put each font into list box
Next i

In another case, the runtime occured right after clicking the OK button in the Print Dialog.
(Print dialog dissapears, runtime message pops up).

Hope this helps...

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.