Return the Module Location & Sub Procedure Name on Error

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



How can I return the Module Location and Sub Procedure of an error when an
error occurs?

Public Sub ProcedureName()

On Error GoTo ErrorHandler

' my code here
Exit Sub

'********************************

ErrorHandler:
Call ErrorHandler(ModuleName, ProcedureName, Err.Number, Err.Description)

End Sub

Public Sub ErrorHandler(ModuleName As String, ProcedureName As String,
ErrNumber As Integer, Description As String)

' show a msgbox with error information

End Sub
--
Cheers,
Ryan
.



Relevant Pages

  • Re: Thread issue
    ... I actually do not want to create a log system. ... Private mLogFile As String ... Public Sub New ... Public Sub LogMessage ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Access popup window from IE object.
    ... Function GetIE(sLocation As String) As Object ... Dim objShell As Object, o As Object ... Private Sub x_NewWindow2 ... Public Sub SetVisible ...
    (microsoft.public.excel.programming)
  • Re: Access popup window from IE object.
    ... Function GetIE(sLocation As String) As Object ... Dim objShell As Object, o As Object ... Private Sub x_NewWindow2 ... Public Sub SetVisible ...
    (microsoft.public.excel.programming)
  • Re: Access popup window from IE object.
    ... Function GetIE(sLocation As String) As Object ... Dim objShell As Object, o As Object ... Private Sub x_NewWindow2 ... Public Sub SetVisible ...
    (microsoft.public.excel.programming)
  • Exceptions not working
    ... and the message in the queue should be ... Public Sub FinalClientRetry() Implements ... Public Sub UpdateUser(ByVal _sUserID As String, ...
    (microsoft.public.dotnet.distributed_apps)