More the one range with DoCmd.TransferSpreadsheet

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?
 
K

Ken Snell \(MVP\)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top