There is no automated way, but you could the module name in a constant and
scatter line numbers periodically through the procedure, and then use the
Erl function to get the last line
number encountered before the error was raised. E..g,

Here is an example

Sub TestErrorLineNumber()
Const sModule As String = "Module1"

On Error GoTo ErrHandler:
10:
' some code
20:
' more code
Err.Raise 1
'etc.
Exit Sub
ErrHandler:
MsgBox "Error: " & Err.Number & " " & Err.Description & vbNewLine & _
"in module: " & sModule & " in project: " & Err.Source & vbNewLine &
_
"around the following line: " & Erl
End Sub

You could also add the procedure name.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"x taol" <tomi3440@yahoo.com> wrote in message
news:%23JA8z%23yCGHA.916@TK2MSFTNGP10.phx.gbl...
>
>
> i wanna know error line and module name when outbreak of error in any
> module.
>
> Sub test()
> On Error GoTo erohandle:
> ~~~~~
> ~~~~~
> Exit Sub
> erohandle:
> MsgBox "the current module name is " & xxxx & vbCrLf & "the line number
> is " & yyyyy
> End Sub
>
>
> *** Sent via Developersdex http://www.developersdex.com ***