Re: Global Error Checking
You can use Erl function
When a run-time error occurs in a Visual Basic for Applications user- defined function with error handling
in effect, the Erl() function returns 0 unless a line number is specified in the user-defined function.
You can return a line number in the Erl() function by specifying a line number on or above the line that
causes the error. The Erl() function will return the line number currently in effect. You must specify
a numeric line number, not an alphanumeric line label. The Erl function() will only return a line number.
Dim x As Integer ' Declare variable.
On Error GoTo ErrorTest_Error
1 x = 1
2 x = 2
3 x = 5 / 0 ' Divide by zero error.
Exit Sub
ErrorTest_Error:
MsgBox "Error occurred in line #" & Erl
Resume Next
This proc will return -> Error occurred in line # 3
Line # >65529 is not supported
Iouri Boutchkine
[email protected]