Well, you can try this
Option Explicit Enum CustomErr LaidEgg = vbObjectError + 100 UserEaten = vbObjectError + 200 Paused = vbObjectError + 300 Cancelled = vbObjectError + 400 End Enum Sub drv() On Error GoTo ErrHandler Err.Raise UserEaten, "Sub drv", "User Eaten Error" MsgBox 1 / 0 Exit Sub ErrHandler: GlobalHandler Resume Next End Sub Sub GlobalHandler() Dim E As Long E = Err.Number - vbObjectError ' needed to avoid Overflow Error If (Err.Number < 0) Then MsgBox "Custom Error, 'Number' = " & E MsgBox Err.Description Else MsgBox Err.Description End If End Sub




Reply With Quote
