Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default How can I still go to the error-code after a On Error Goto?

If I use the 'On Error Goto' to send a report by email how can I
include the line code that caused the error?

And how can I still go to the vba-code-line to debug it?

It seems Err. is missing something like Err.Line or Err.Code.....
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default How can I still go to the error-code after a On Error Goto?

Hi Michel;

You can use OnError Resume Next and then after the
potiential error use this:

If Err.Count < 0 Then
GoTo ErrorHandler
End If


-----Original Message-----
If I use the 'On Error Goto' to send a report by email

how can I
include the line code that caused the error?

And how can I still go to the vba-code-line to debug it?

It seems Err. is missing something like Err.Line or

Err.Code.....
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default How can I still go to the error-code after a On Error Goto?

You can use the old Erl syntax, a remnent from old basic BUT not documented.
VB.NET still has this and it is documented.

Sub ErrLineExample()

On Error GoTo ErrorHandler
Dim intAge As Integer
Dim i As Integer
Dim str As String

10 intAge = "MyAge"
20 '//
30 i = 1 / 0
40 str = "Test"
50 i = str
60 '
70 '


Exit Sub
ErrorHandler:
MsgBox Err.Description & " Error occurred at line : " & Erl()
Err.Clear
Resume Next

End Sub

(Michel) wrote in message . com...
If I use the 'On Error Goto' to send a report by email how can I
include the line code that caused the error?

And how can I still go to the vba-code-line to debug it?

It seems Err. is missing something like Err.Line or Err.Code.....

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
On error goto problem Coppercrutch Excel Discussion (Misc queries) 3 December 28th 07 03:04 PM
On Error GoTo Doesn't Work [email protected] Excel Discussion (Misc queries) 2 November 29th 07 09:43 PM
On Error GoTo : How to use multiple? e18 Excel Programming 8 May 17th 04 11:41 PM
On error goto 0? Brian Tozer Excel Programming 10 December 29th 03 09:59 PM
On error goto 0 David Excel Programming 2 November 18th 03 01:43 PM


All times are GMT +1. The time now is 01:27 AM.

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"