More the one range with DoCmd.TransferSpreadsheet

  • Thread starter Thread starter amir369
  • Start date Start date
A

amir369

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.
I'd try to name the multiplied rangs in the Excel sheet, but Access didn't
recognize this name.

Any idea?
 
TransferSpreadsheet will not allow noncontiguous cells for the Range
argument when importing.

You'll need to do one of the following:

Do two separate imports, one for each contiguous cell range.

OR

Use Automation to read the data from the EXCEL worksheet and write the data
into the table.

See http://www.accessmvp.com/KDSnell/EXCEL_ImpExp.htm for examples of
various import methods.
 
Back
Top