Does anyone know the description of ERROR CODE # 6???

mel1s2

New Member
Joined
Jul 16, 2005
Messages
48
I have a screenshot of an ERROR # 6 but the description is in chinese... is there a way to force an error or force a description??? :oops: :oops: :oops: :oops: :oops:
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
I found this in the VBA Help files:

Overflow (Error 6)


An overflow results when you try to make an assignment that exceeds the limitations of the target of the assignment. This error has the following causes and solutions:

The result of an assignment, calculation, or data type conversion is too large to be represented within the range of values allowed for that type of variable.
Assign the value to a variable of a type that can hold a larger range of values.

An assignment to a property exceeds the maximum value the property can accept.
Make sure your assignment fits the range for the property to which it is made.

You attempt to use a number in a calculation, and that number is coerced into an integer, but the result is larger than an integer. For example:
Dim x As Long
x = 2000 * 365 ' Error: Overflow
To work around this situation, type the number, like this:

Dim x As Long
x = CLng(2000) * 365
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).
 

mel1s2

New Member
Joined
Jul 16, 2005
Messages
48
error numbers

Ok, quick question. Is there a way to force and error number to see the definition. The issue is my program is used by other countries that have their Windows set up in their own language. The program works fine on all other machines. So I have error traps all over the place that tells me the Error number, definition and the procedure that the error occured. Only problem is that when they send me a screenshot, the number and procedure come over in English but the err.description is in Chinese for example. So even though I know what procedure to look in, I have no clue where at or what caused the error.
 

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686

ADVERTISEMENT

You could always try add the Erl function to your error trapping. It is not documented in the VBA help file (I can't seem to find it, at any rate), but if you have numbered the lines of code, you can return at what line number the error occurred.

Here's one example:
http://groups.google.com/group/micr...read/thread/6072dadd89b74559/239af100707c527c

You could also capture the data to display whatever message you want. For example, in one project I did I set it to display the information I would need to pinpoint where the error occurred:

Code:
MsgBox "An error has occurred." & vbCrLf & _
      "Please inform Kristy of this information:" & _
      String(2, vbCrLf) & "Sub:  " & ErrSource & _
      vbCrLf & "Line:  " & Erl & vbCrLf & _
      "Error:  " & Err.Number & vbCrLf & "Description:  " & _
      Err.Description & String(2, vbCrLf), vbOKOnly + vbCritical, "Error"

In this example, I have saved the name of each sub in a variable named ErrSource so when the error does occurr I know which macro the error was in. It then returns the line number, error number and description.

In your case, the description would still be in a different language, but you could also get the other information.
 

mel1s2

New Member
Joined
Jul 16, 2005
Messages
48
I fixed my original error, but for future reference.
Your message box looks almost identical to mine not counting the erl function. I will try this. I was placing a public variable called intErrNum and troughout the code I would hard code a number for it and pass that to my error procedure which is (variables)
An Unexpected Error has occured,
Please contact (curPgr) with the following information
Error Number: (err.Number)
Error Decription: (err.Description)
Error Procedure: (PrcName & " " & intErrNum)

At the end of each procedure of my code I have
errOut:
call errOutEarly("Procedure")
So will erl replace my intErrNum and then how do I find that line again.
 

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
As explained in the example I linked to in the previous post, you have to add line numbers in the code itself. That's the only way the Erl function will work.

Code:
Sub test()
Dim ErrSource As String

10    ErrSource = "test" 'the name of the sub
On Error GoTo ErrHandler:
20        Debug.Print "Some Code Here"
30        Debug.Print "More Code Here"

      'this causes an error that will be trapped by the error handler
40        Err.Raise 1

50        Exit Sub

ErrHandler:
60        MsgBox "An error has occurred." & vbCrLf & _
            "Please inform Kristy of this information:" & _
            String(2, vbCrLf) & "Sub:  " & ErrSource & _
            vbCrLf & "Line:  " & Erl & vbCrLf & _
            "Error:  " & Err.Number & vbCrLf & "Description:  " & _
            Err.Description & String(2, vbCrLf), vbOKOnly + vbCritical, "Error"
End Sub


As far as numbering the lines goes, you can do it manually or find/write a program to automatically do it. I know that the MZ-Tools add-in has this ability (it's also a generally handy add-in, in my opinion).
http://www.mztools.com/index.htm
 

Forum statistics

Threads
1,136,305
Messages
5,674,984
Members
419,541
Latest member
freddyboots

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top