Results 1 to 5 of 5
  1. #1
    rpkfish is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    2

    Worksheet within Excel Workbook

    I know that when I create an External Data Import from an Excel Workbook I can define which worksheet I wish to use.



    My current problem is that I have a Workbook with four Worksheets, three of which feed (append) data into different Tables in my database. The 4th one supplies the data.

    How do I import from the correct worksheet using ImportExportSpreadsheet? Or is there an alternative way. I need the macro so that it can be a Menu driven option.

    Help, please!

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,413
    Not quite sure what you are asking - perhaps some example data will help me/us to understand.

    whichever method you use, you can only 'link' to one worksheet/range per import/export - but you can have 4 import/exports, one for each worksheet/range.

    If these tables need to interact in some way as part of the import process, either import or link to each worksheet/range so you have 4 tables in your db - then use append and/or update queries in the usual way

  3. #3
    rpkfish is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2016
    Posts
    2
    I am happy that I have to have 4 separate ImportExportSpreadsheet statements but how do I define the Worksheet within the Workbook. Every example of coding that I can find refers to Workbook.xlsx. Should I say Workbook.worksheet.xslx? When I look at the statement in Saved Imports it only refers to Workbook.xlsx despite the fact that I pointed to the correct worksheet in the creation.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,413
    as part of the creation you are given the opportunity to create a name for the table - which defaults to the name of the worksheet

    What code are you actually using?

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Maybe Ken Snell's site will help.

    See
    Import Data from All Worksheets in a single EXCEL File into Separate Tables via TransferSpreadsheet (VBA)
    http://www.accessmvp.com/kdsnell/EXC...pAllWktsSepTbl

    If you want to import each Excel worksheet to a specific Access table (append or overwrite), you will have to modify the code.

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

Similar Threads

  1. Export to excel but clear worksheet first
    By mercapto in forum Import/Export Data
    Replies: 3
    Last Post: 05-17-2015, 11:57 AM
  2. Replies: 4
    Last Post: 12-17-2012, 01:21 PM
  3. VBA to Import Excel Worksheet
    By bdaniel in forum Programming
    Replies: 2
    Last Post: 11-23-2010, 10:53 AM
  4. Replies: 1
    Last Post: 11-21-2010, 10:26 PM
  5. Importing the second excel worksheet
    By geoffwbailey in forum Programming
    Replies: 1
    Last Post: 06-25-2010, 12:16 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