467,081 Members | 995 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,081 developers. It's quick & easy.

more the one range with DoCmd.TransferSpreadsheet

Hi All,
I'm trying to import an Excel sheet, but with more the one rang, couse the columns aint sequence.
for example:
DoCmd.TransferSpreadsheet acImport, , "DailyRprzntvRpt", _
Application.CurrentProject.Path & "\DailyRprzntvRpt.xls", True, "(A1:C18, F1:J18)"

I'm getting an error, that saies that the range is not recognized by Access.

Any idea?
Jan 12 '09 #1
  • viewed: 7155
Share:
2 Replies
ADezii
Expert 8TB
@amir369
I'm not 100% sure on this one, but I think you can only perform the Import on a single, specified Range as in:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.TransferSpreadsheet acImport, , "DailyRprzntvRpt", _
  2. Application.CurrentProject.Path & "\DailyRprzntvRpt.xls", True, "A1:C18"
Jan 12 '09 #2
Expert Mod 2GB
ADezii is spot-on - you cannot use a split range with TransferSpreadsheet under any circumstances. If you look up the the help information for the TransferSpreadsheet action it is clear about what a range is:

Range
The range of cells to import or link. Leave this argument blank to import or link the entire spreadsheet. You can type the name of a range in the spreadsheet or specify the range of cells to import or link, such as A1:E25 (note that the A1..E25 syntax does not work in Access 97 or later). If you are importing from or linking to an Excel version 5.0 or later spreadsheet, you can prefix the range with the name of the worksheet and an exclamation point; for example, Budget!A1:C7. Note When you export to a spreadsheet, you must leave this argument blank. If you enter a range, the export will fail.
Why not just import all columns and ignore the additional columns D and E imported into your table? You are not obliged to refer to them in whatever subsequent queries you use on your Excel-imported data if you do not need to.

-Stewart
Jan 12 '09 #3

Post your reply

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

Similar topics

2 posts views Thread by mcnewsxp | last post: by
1 post views Thread by Bill Agee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.