I never ever get a value for Erl() , the error line number, & doesn't take me to debug mode to pinpoint the error... makes it very hard to troubleshoot...
I'm still learning VBA so there would be better error handling that I could probably do... but for now most of my Subs have this:
The message box shows:
Have lots of code at moment, 5 modules & would like to be able to see exactly what line of code is causing the error in order to quickly/easily troubleshoot & at least for other users of the spreadsheet to report any errors that may occur in a msgbox easily.
Would like to be able to see:
* macro/sub/module of error
* line# of error
Any ideas why please? Or a better way to do it?
-----------------------
WinVista + Off2010
Win7 + Off2007
I'm still learning VBA so there would be better error handling that I could probably do... but for now most of my Subs have this:
Code:
'Error Handler
DataExtract_Err:
Application.ScreenUpdating = True
MsgBox "SOURCE: " & Err.Source _
& vbCrLf & "ERROR# " & Err.Number & ", LINE# " & Erl() & ", HelpContext: " & Err.HelpContext _
& vbCrLf & vbCrLf & Err.Description _
, vbCritical, "DataExtract Error!"
Resume DataExtract_Exit
End Sub
The message box shows:
Data Extract Error!
SOURCE: Microsoft Office Excel
ERROR# 1004, LINE# 0, HelpContext: 1001004
Select method of Range class failed
[OK]
Have lots of code at moment, 5 modules & would like to be able to see exactly what line of code is causing the error in order to quickly/easily troubleshoot & at least for other users of the spreadsheet to report any errors that may occur in a msgbox easily.
Would like to be able to see:
* macro/sub/module of error
* line# of error
Any ideas why please? Or a better way to do it?
-----------------------
WinVista + Off2010
Win7 + Off2007
Last edited: