Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Get Module line # for error trapping

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Get Module line # for error trapping

Hmmm... I had forgotten about line numbers. This means
that you have to number the lines. Perhaps one could just
number lines with a high potential to generate a runtime
error. Interesting...
Geof.
-----Original Message-----
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.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Get Module line # for error trapping

Here's a bizzare solution:
1) Export the VBA code to a cls file.
2) Import the cls file to an Access table with an
autonumber field.
3) Export the Access table to a text file of some sort.
4) Import the text file into an Excel module.
-----Original Message-----
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.



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Get Module line # for error trapping

Geoff,
MZ-Tools has a (among many other very useful functions) a function which
will add line number to your code. http://www.mztools.com


Alex J


"Geof Wyght" wrote in message
...
Here's a bizzare solution:
1) Export the VBA code to a cls file.
2) Import the cls file to an Access table with an
autonumber field.
3) Export the Access table to a text file of some sort.
4) Import the text file into an Excel module.
-----Original Message-----
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.



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Get Module line # for error trapping

Thanks, Alex, I'll have a look at them.
-----Original Message-----
Geoff,
MZ-Tools has a (among many other very useful functions) a

function which
will add line number to your code. http://www.mztools.com


Alex J


"Geof Wyght" wrote

in message
...
Here's a bizzare solution:
1) Export the VBA code to a cls file.
2) Import the cls file to an Access table with an
autonumber field.
3) Export the Access table to a text file of some sort.
4) Import the text file into an Excel module.
-----Original Message-----
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.


.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trapping #VALUE! error RhysPieces Excel Discussion (Misc queries) 6 August 22nd 07 03:13 AM
error trapping flow23 Excel Discussion (Misc queries) 3 April 13th 06 04:51 PM
On Error, Capturing current module and actual line of code Paul Martin Excel Programming 4 June 13th 04 06:21 AM
trapping error RobcPettit Excel Programming 2 January 30th 04 03:37 AM
error trapping libby Excel Programming 5 November 25th 03 10:57 PM


All times are GMT +1. The time now is 07:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"