From Newsgroup: comp.databases.ms-access
Should have googled first !! Found it:
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
Jim
On Monday, 2 November 2020 at 13:55:58 UTC, Keith Tizzard wrote:
I know how to import a spreadsheet with
DoCmd.TransferSpreadsheet
However I have one that is password protected. Is there a way of importing it into Access using VBA by providing the password?
An alternative would be to create a link to it. I would still need a way of providing the password.
Jim
--- Synchronet 3.21b-Linux NewsLink 1.2