Solved

Printer error 482

Posted on 1998-09-27
4
1,540 Views
Last Modified: 2010-10-29

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

'errorhandling
On Error GoTo ERRORHANDLER

'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
    Else
   
    'go ahead...
    CommonDialog1.DialogTitle = "Select a printer"
    CommonDialog1.Flags = &H100&
    CommonDialog1.ShowPrinter
   
    Me.Refresh
   
    '...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"
        Printer.Print "abcdefghijklmnopqrstuvwxyz"
        Dim char As String
        char = "²&é(§è!çà)-^$ùµ<,;:=³1234567890°_¨*%£>?./+|@#^{}[]´`\~"
        Printer.Print char
        Printer.EndDoc  'that's all
       
        End If
    Next

End If

Exit Sub
 
ERRORHANDLER:
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,
regards.

0
Comment
Question by:dvbasic
4 Comments
 
LVL 1

Expert Comment

by:kacklehorn
Comment Utility
What version of VB? What line of Code do you get the error on?
0
 
LVL 12

Expert Comment

by:mark2150
Comment Utility
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.

M
0
 

Author Comment

by:dvbasic
Comment Utility
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
    formstart.lblCount.Refresh
    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...



0
 
LVL 3

Accepted Solution

by:
fguerreiro_inix earned 200 total points
Comment Utility
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
Regards
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now