Private Sub pr_ExcelFileImport() Dim m_XlsFl As Excel.Application 'Excel.Application Dim m_XlsWbk As Excel.Workbook On Error GoTo Err_UpLd Screen.MousePointer = vbDefault Dim xlFlPasswrd As Variant xlFlPasswrd = InputBox("Enter Password for opening of Excel file") If xlFlPasswrd = "" Then Exit Sub End If m_XlsFl.Workbooks.Open m_XlsFileNm, Password:=xlFlPasswrd ' here the error occurs, error no 91 when input wrong password. ‘ my codes here…………………… m_XlsFl.ActiveWorkbook.Close False m_XlsFl.Workbooks.Close m_XlsFl.Quit Set m_XlsFl = Nothing Err_UpLd: ‘ I wants to do is if err.number = 91 then msgbox "wrong password" End Sub
Err_UpLd: If(Err.Number = 91) then MsgBox "Wrong password" End If End Sub
Err_UpLd: If(Err.Description <> "") Then MsgBox "Error Ocurred --> " & Err.Description End If
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)