(Solved) – Getting TypeMisMatch Error 13: when trying to open password protected Excel file [closed]


I am working on opening of password protected Excel file from another Excel sheet and I keep getting Run-time error 13: Type mismatch. I know the password and putting it along the filepath with WriteResPassword finally allowed me to open the Excel file. However, once opened, I get the error which makes no sense to me. May I please ask for help on this as I cannot find way around it? Thank you in advance!

Option Explicit

Sub OpenARMonthEndUSD()
    Dim CashTrackerPath As String

    Dim wbSrc As Workbook
    Dim CashTrackerSheet As Worksheet

    CashTrackerPath = "G:ARINVprintReportingCashTrackerMyTEST2.xlsm"

    Application.DisplayAlerts = False
    Set CashTrackerSheet = Workbooks.Open(Filename:=CashTrackerPath, Password:="xxxx", WriteResPassword:="xxxx")
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *