Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem using TransferSpreadsheet

Status
Not open for further replies.

akirk

Technical User
Mar 28, 2002
27
US
I am trying to import a specific worksheet from an excel document into Access. The excel document contains two tabs, UploadTest, and UsageExport. I am trying to figure out how to import only the data in the UsageExport tab, which is the second tab in the document. The problem is that the code seems to look at the first tab. Below is my code:

DoCmd.TransferSpreadsheet transfertype:=acImport, _
spreadsheettype:=asSpreadsheetTypeExcel7, _
tablename:="tblUpload", _
filename:="H:\Access\User Story Database Uploads\UsageUpload.xls", _
hasfieldnames:=True, _
range:=UsageExport

Before I added the second tab to the spreadsheet, and added the range: line to this procedure, it worked perfectly. I am sure that it is something really simple, but the solution is eluding me.

Thanks

Kirk
 
just did a little experimentation, you should add the exclamation mark after the sheet name to import the whole sheet.
range:=UsageExport!

otherwise specify a range
range:=UsageExport!A1:A8


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top