Hi There,
Im saving an excel workbook using VBA that is password protected... I have turned off every known event and handled all errors, however when someone provides the wrong password to open the workbook, I get "password error". I dont like popups and want to handle it but its not working... thoughts?
K.
ThisWorkbook.SaveCopyAs (GetCurrPath & "\" & NewName & ".xls")
Dim answer As String, i As Integer
Application.EnableEvents = False
Application.DisplayAlerts = False
Application.ScreenUpdating = False
answer = InputBox("Provide Password to Open the Extract - its the same as the source document", "Password to Open the Extract")
Set NewBook = Nothing
On Error Resume Next
Set NewBook = Excel.Workbooks.Open(GetCurrPath & "\" & NewName & ".xls", , , , answer)
If Err <> 0 Then
MsgBox "Incorrect Password"
End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
Im saving an excel workbook using VBA that is password protected... I have turned off every known event and handled all errors, however when someone provides the wrong password to open the workbook, I get "password error". I dont like popups and want to handle it but its not working... thoughts?
K.
ThisWorkbook.SaveCopyAs (GetCurrPath & "\" & NewName & ".xls")
Dim answer As String, i As Integer
Application.EnableEvents = False
Application.DisplayAlerts = False
Application.ScreenUpdating = False
answer = InputBox("Provide Password to Open the Extract - its the same as the source document", "Password to Open the Extract")
Set NewBook = Nothing
On Error Resume Next
Set NewBook = Excel.Workbooks.Open(GetCurrPath & "\" & NewName & ".xls", , , , answer)
If Err <> 0 Then
MsgBox "Incorrect Password"
End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True