Hi everyone,
I put one of my codes in Bing Chat and asked him to help me refactor it. It did, but in the end, instead of throwing my Error Handler as it was, it did it like this:
What I had before:
Isn't this a cleaner way to handle errors?
I put one of my codes in Bing Chat and asked him to help me refactor it. It did, but in the end, instead of throwing my Error Handler as it was, it did it like this:
Code:
Form_Load_Error:
ShowErrorMessage "Form_Load", Erl
End Sub
Public Sub ShowErrorMessage(ByVal strProcedureName As String, ByVal intLineNumber As Integer)
MsgBox "Errorr " & Err.Number & " (" & Err.Description & ") in procedure " & strProcedureName & ", line " & intLineNumber & "." & vbCr & "Contact admin.", vbInformation, "ZM"
End Sub
What I had before:
Code:
Form_Load_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_Load, line " & Erl & "." & vbCr & "Contact admin.", vbInformation, "ZM"
End Sub
Isn't this a cleaner way to handle errors?