Excel to Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am transferring data into an existing table in Access. I have multiple
worksheets to import within a workbook and I used the transfer spreadsheet
action. The transfer spreadsheet action works fine when I specify a range
within a worksheet but it won't let me specify the worksheet alone. I don't
know the number of rows within the worksheet so I can't specify that into the
coded action every time.

Thanks for your help.
 
Hi, Steve.

To import the entire worksheet instead of a range, you need to follow the
name of your spreadsheet with an exclamation point. For example:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
"tblSheet2", "C:\Test\TestImport.xls", True, "MySht2!"

where "tblSheet2" is the name of the table, "C:\Test\TestImport.xls" is the
path and name of the file holding the spreadsheet, and "MySht2" is the name
of the worksheet to import.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts, so that all
may benefit by filtering on "Answered questions" and quickly finding the
right answers to similar questions. Remember that the best answers are often
given to those who have a history of rewarding the contributors who have
taken the time to answer questions correctly.
 
Back
Top