Hi,
I need Access to link to an excel spreadsheet that is range password protected.
I just need a way of getting the data into Access on an ad-hoc basic.
I've tried the spreadsheet transfer method however I get the above error. Can anyone help PLEASE?!
I know the password and have tried the code below found at
http://accessblog.net/2005/04/how-to-import-password-protected-excel.html
however I cannot get it to work HELP HELP HELP
I need Access to link to an excel spreadsheet that is range password protected.
I just need a way of getting the data into Access on an ad-hoc basic.
I've tried the spreadsheet transfer method however I get the above error. Can anyone help PLEASE?!
I know the password and have tried the code below found at
http://accessblog.net/2005/04/how-to-import-password-protected-excel.html
however I cannot get it to work HELP HELP HELP
Code:
Public Sub ImportProtected(strFile As String, _
strPassword As String)
Dim oExcel As Object, oWb As Object
Set oExcel = CreateObject("Excel.Application")
Set oWb = oExcel.Workbooks.Open(FileName:=strFile, _
Password:=strPassword)
DoCmd.TransferSpreadsheet acImport, _
acSpreadsheetTypeExcel9, "Import", strFile, -1
oWb.Close SaveChanges:=False
oExcel.Quit
Set oExcel = Nothing
End Sub