By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,397 Members | 1,425 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,397 IT Pros & Developers. It's quick & easy.

Transfer Excel data to Access

Expert 100+
P: 218
Hi

I need to pull data from an Excel worksheet to a data table, using Access & VBA.

I am trying to use the "DoCmd.TransferSpreadsheet acImport" method, but...

My problem is that the sheet I need to get at is one of four in the workbook & is called "finance codes". I can pick up the data from sheet 1, but I can't seem to grab the data from the sheet I need....

All help gratefully received

TIA

Steve
Nov 30 '06 #1
Share this Question
Share on Google+
2 Replies


100+
P: 143
You refer to the sheet by name and it's range, like so

Dim strPathName As String

strPathName = "g:\xl\ImportTest.XLS" 'Your path name here
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="ZZ", filename:=strPathName, Hasfieldnames:=False, Range:="A Test!a1:a20"
Nov 30 '06 #2

Expert 100+
P: 218
Hi Tanis

You refer to the sheet by name and it's range, like so
strPathName = "g:\xl\ImportTest.XLS" 'Your path name here
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="ZZ", filename:=strPathName, Hasfieldnames:=False, Range:="A Test!a1:a20"
How come it didn't work when I tried it first time!!! (Doh)

Thanks anyway
Nov 30 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.