View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Umlas[_3_] Bob Umlas[_3_] is offline
external usenet poster
 
Posts: 320
Default Get Module line # for error trapping

You can number all your lines (no colons):
and display the error line using erl:

Sub LookHere()
100 a=5
200 a=6
300 On Error GoTo ErrRtn
400 msgbox 5/0 'gives an error
500 exit sub
ErrRtn:
Msgbox "Error in line " & erl
End Sub

"Geof Wyght" wrote in message
...
Hello everyone,
When I error trap, I write out the module name and
procedure name. I always wanted to drill down one more
layer and write out the line that was executing in the
procedure when the runtime error occured. I've looked at
lots of line-type properties of the VBE object, but can't
seem to find the one I've described. Am I out of luck?
Thanks.
Geof.