Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Is there a way of knowing on wich line an error occured?

Posted on 2008-06-12
2
144 Views
Last Modified: 2010-04-30
When prog. has already jumped to ErrorHandler?
(Can't disable error handling in this case)
0
Comment
Question by:davidsperling
2 Comments
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 21767176
Nope. It's one of those annoying things about VB/VBA error handling.

What you can do is add line numbers. VB and VBA error handling includes the ability to display the line number of the statement in error with the following caveats: the line number is only accessible from within the routine where the error occurred, and line numbers reduce the ability to maintain code. That said, the line number is access using the Erl variable:

10   On Error GoTo MyRoutine_Error
20   ...
80   Exit Sub
MyRoutine_Error:
90   MsgBox "Error """ & Err.Description & """ occurred at line " & Erl & " of MyRoutine"

A third party tool that can add and remove line numbers in a VB or VBA project can be found http://www.mztools.com/v3/download.aspx.

Kevin
0
 
LVL 4

Author Comment

by:davidsperling
ID: 21767197
Well, if you can't disable error handling you can't add line numbers to the code either ;-) (It's n add-in I cannot change)

Thanks anyway, the points are your's :-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question