469,964 Members | 1,772 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,964 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
2 7396
8,800 Expert 8TB
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
Stewart Ross
2,545 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:

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.

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.