Of course it can be done - like I said you can check error number:
Code:Private Sub Command1_Click() Dim errorMessage As String On Error GoTo ErrHandler 'MAIN CODE GOES HERE... Exit Sub ErrHandler: ''MsgBox Err.Description 'PLEASE NOTE THAT 1 AND 2 ARE NOT ACTUAL ERROR NUMBERS 'DETERMINE WHICH ONES YOU'RE LOOKING FOR AND REPLACE THEM Select Case Err.Number Case 1 errorMessage = "Do this..." Case 2 errorMessage = "Do that..." End Select MsgBox errorMessage, vbExclamation + vbOKOnly, "Error: " & Err.Number Err.Clear Exit Sub End Sub




Reply With Quote