A Generic Procedure Skeleton with Basic Error Handling : Exit « Language Basics « VBA / Excel / Access / Word






A Generic Procedure Skeleton with Basic Error Handling

 
Sub GenericProcedure() 
    On Error GoTo ErrHandler 
    Exit Sub 
ErrHandler: 
    MsgBox "An error has occurred. " & _ 
           Err.Number & ": " & Err.Description _ 
           , vbInformation + vbOKOnly, "An Error has occurred." 
    Debug.Print "ERROR OCCURED IN GenericProcedure..." 
    Debug.Print Err.Number & ": " & Err.Description 
End Sub 

 








Related examples in the same category

1.Using an Exit Do Statement
2.Exiting a For...Next Loop Early