Error_Raise

To raise a friendly error message with option to show custom error number and description, also option to end the run of Excel macro
Better than the "End - Debug" window
If no error info passed, current internal error number and description is shown

Sub Error_Raise(Optional ErrNum = "", Optional ErrDesc = "", Optional EndRun = 1)
 AppName = SettingRead("AppName")
 If ErrNum = "" Then ErrNum = Err.Number
 If ErrDesc = "" Then ErrDesc = Err.Description
 MsgBox "Error found while trying running " & AppName & "!!!" & vbCrLf & vbCrLf & _
  "Error#:" & ErrNum & vbCrLf & "Error: " & ErrDesc, vbCritical
 If EndRun = 1 Then
  Application.Calculation = xlCalculationAutomatic
  Application.ScreenUpdating = True
  End
 End If
End Sub

Parameters

Optional ErrNum, Optional ErrDesc, Optional EndRun

Views 115 Downloads 50

Perm link