Mega Code Archive

 
Categories / VisualBasic Script / Language Basics
 

An Example of Error Handling Using the On Error GoTo Statement

Sub SimpleErrorHandler()     On Error GoTo SimpleErrorHandler_Err     Dim sngResult As Single     sngResult = 1 / 0     Exit Sub SimpleErrorHandler_Err:     msgBox "Oops!"     Exit Sub End Sub