Results 1 to 5 of 5
  1. #1
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283

    Importing Excel Workbook with multiple Worksheets

    Hello,



    I know how to import a file into a table using this code:

    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TableName", FileAddress, True, "WorkSheet!"

    Is there a way to transfer multiple worksheets from the same workbook with one DoCmd.TransferSpreadsheet?

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    No you need 1 transfer command for each sheet,
    but 1 macro to run them all.

  3. #3
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    I don't need a macro right? if there's 3 different worksheets i need to import I do 3 Transfer commands?

  4. #4
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    yes 1 macro has 3 commands
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TableName", FileAddress, True, "WorkSheet1!"
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TableName", FileAddress, True, "WorkSheet2!"
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TableName", FileAddress, True, "WorkSheet3"

  5. #5
    MTSPEER is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    283
    Okay so in the range section in the macro just put the worksheet name in there?

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

Similar Threads

  1. Using Access to Count Worksheets in Workbook
    By jadown in forum Programming
    Replies: 3
    Last Post: 03-10-2015, 07:31 PM
  2. Replies: 4
    Last Post: 10-03-2014, 12:27 PM
  3. New workbook/worksheets using Transfer Spreadsheet
    By nyneave in forum Import/Export Data
    Replies: 3
    Last Post: 09-05-2012, 06:44 PM
  4. Replies: 1
    Last Post: 03-12-2012, 02:21 PM
  5. Deleting Worksheets on a Excel workbook
    By BED in forum Programming
    Replies: 0
    Last Post: 07-27-2010, 01:20 PM

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