Consulting

Results 1 to 5 of 5

Thread: Import Excel Spreadsheet Into Access

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Tutor jo15765's Avatar
    Joined
    Oct 2011
    Posts
    281
    Location

    Import Excel Spreadsheet Into Access

    Their is a spreadsheet downloaded from a server daily. I want to through VBA create a table in access 2000 and import the spreadsheet (could be .xls or .xlsx) into the newly created table.

    This is what I was working with --- not working properly, but I think *fingers crossed* it's close to it
    Function ImportSpreadsheet
    Dim filename, table, worksheetName As String
    Dim hasFieldNames As Boolean
    Dim ws As Integer
    
    bhasFieldNames = False
    
    table = "TestingImportThroughVBA"
    worksheetName = "Sheet 2"
    filename = "C:\Testing\TestWorksheet.xls"
    
    For ws = 1 to 1
      Do While Len(filename) > 0
        DoCmd.TransferSpreadsheet acImport, acSpreadshetTypeExcel9, table, filename, hasFieldNames
      Loop
    Next ws
    End Function
    Last edited by jo15765; 01-15-2015 at 12:58 PM.
    Go to Heaven for the climate, Hell for the company.
    ~~Mark Twain

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •