Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003

    Unanswered: Importing from Excel

    Hello all,

    I am a programmer having a relatively simple problem with the DoCmd.TransferSpreadsheet function. I want to import ALL of the worksheets of a particular .xls file. When I run the DoCmd.TransferSpreadsheet function, I only get the first worksheets information. Is there a way to force it to import all of the tabs of the file?

    Thanks in advance for any assistance in this regard.

  2. #2
    Join Date
    Jul 2003
    The TransferSpreadsheet action can only link/import one sheet at a time (or a range on that sheet). If you want to link/import all sheets at once, you need multiple TransferSpreadsheet actions in one macro. Alternatively, you could write a VBA function which performs this task for you. Something like:

    Public Function ImportWorkBook(strWorkbook as string) as boolean

    * create Excel instance
    * open the specific workbook using this instance
    * loop through all worksheets
    * link/import them using the worksheet name as tablename
    * close Excel instance

    End Function

    Something like that.


    A 3D editor project

Posting Permissions

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