How do you to set up VBA code to read data from an Excel workbook that has a password on the workbook and an autoexec macro that requests another password? The following code works if the Excel spreadsheet is not protected.
DoCmd.TransferSpreadsheet transfertype:=acImport, SpreadsheetType:=5, _
tablename:="tbl_Temp_Import_Of_TimeSheets", FileName:=strTimeSheetName, _
Hasfieldnames:=False, Range:="Input Sheet!A1:AZ5202"
Opening the file using
xlApp2.Visible = True
strTimeSheetName = "C:\data\500685.xls"
xlApp2.Workbooks.Open FileName:=strTimeSheetName, _
Password:=" 123456789 "
does not work as the system sits waiting for the user input.
DoCmd.TransferSpreadsheet transfertype:=acImport, SpreadsheetType:=5, _
tablename:="tbl_Temp_Import_Of_TimeSheets", FileName:=strTimeSheetName, _
Hasfieldnames:=False, Range:="Input Sheet!A1:AZ5202"
Opening the file using
xlApp2.Visible = True
strTimeSheetName = "C:\data\500685.xls"
xlApp2.Workbooks.Open FileName:=strTimeSheetName, _
Password:=" 123456789 "
does not work as the system sits waiting for the user input.