by Kamilche (35 Submissions)
Category: Coding Standards
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating:
(30 Votes)

This is the complete code for a VB IDE addin that will add error handling to your procedure. Requires that you have a routine called "HandleError" in a public module accessible to all routines. Sample HandleError routine follows:
Public Sub HandleError(ByVal CurrentModule As String, ByVal CurrentProcedure As String, _
ByVal ErrNum As Long, ByVal ErrDescription As String)
On Error GoTo Err_Init
MsgBox CurrentModule & " " & CurrentProcedure & ": " & ErrNum & " - " & ErrDescription
Exit Sub
Err_Init:
MsgBox CurrentModule & " HandleError: " & Err.Number & " - " & Err.Description
End Sub
Exit (sub, function, or property here)
Err_Init:
HandleError CurrentModule, "(your routine name here)", Err.Number, Err.Description
Upload