Sub MyMacro() Dim MyWorkbook As Workbook ' Run the Error handler "ErrHandler" when an error occurs. On Error GoTo Errhandler ChDrive "B:" ChDir "B:\" ChDir "B:\XLFiles" Workbooks.Open "Book1.xls" ' Disable the error handler. On Error GoTo 0 Set MyWorkbook = ActiveWorkbook MsgBox "The destination workbook is " & MyWorkbook.Name ' Exit the macro so that the error handler is not executed. Exit Sub Errhandler: Select Case Err Case 68, 75: ' Error 68: "Device not available" ' Error 75: "Path/File Access Error" MsgBox "There is an error reading drive B." Case 76: ' Error 76: "Path not found" MsgBox "The specified path is not found." Case Else: ' An error other than 68, 75 or 76 has occurred. ' Display the error number and the error text. MsgBox "Error # " & Err & " : " & Error(Err) End Select ' End the macro. End Sub