• Import spreadsheet

    From Keith Tizzard@21:1/5 to All on Mon Nov 2 05:55:52 2020
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Keith Tizzard@21:1/5 to Keith Tizzard on Mon Nov 2 08:24:59 2020
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)