Results 1 to 2 of 2
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2016
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670

    Import Specified Range Of Excel Into Access Table

    I am trying to use VBA to import an Excel file into access. And I am specifying a range, and specifying that it has headers.



    This is the code that I have
    Code:
    Dim importFile As String
    importFile = "C:\Test\test.xls"
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "Test", importFile, True, "A5:ZZZ99999999"

    and the A5 - ZZZ99999 is just saying import all that because I have no idea where the data will actually end.

    but I get an error of
    Run-time error '3011':
    The Microsoft access database engine could not find the object 'A5:ZZZ999999'. Make sure the object exists and that you pell its name and the path correctly

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    does your excel file actually have zzz columns? Exceltype8 is excel 97. Being over 23 years old I'm pretty sure it did not have zzz columns and I'm absolutely positive it did not have more than 64000 rows. Even a xlsx only has xfd columns. Suggest restate your range to something that is actually possible

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Import from Excel, using a Named range for control
    By Western_Neil in forum Import/Export Data
    Replies: 15
    Last Post: 01-22-2019, 06:57 PM
  2. Replies: 17
    Last Post: 09-17-2018, 05:18 PM
  3. Replies: 4
    Last Post: 12-17-2012, 01:21 PM
  4. Import excel worksheet by range with non identical headers
    By snoopy2003 in forum Import/Export Data
    Replies: 1
    Last Post: 03-14-2011, 01:04 AM
  5. How to import named range from excel
    By timpepu in forum Import/Export Data
    Replies: 1
    Last Post: 02-19-2010, 11:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums