Matt Cremeens
Matt Cremeens

Reputation: 5151

MS Access unable to locate my excel range when importing

I have this code that works on one spreadsheet, but not another. I am just trying to automate the transfer of an excel data range to an access table, like so

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "UsysFastTrack", strFilePath, False, strRange

strFilePath and strRange are just strings that contain the full file path (including the worksheet name and extension) and the name of an excel range in the worksheet, respectively. This line causes an error

The Microsoft Access database engine could not find the object ...

This error appears a lot online and somewhere I saw the advice to try the import wizard to see what I get and lo and behold, right as I hit the last Next

enter image description here

This is the exact same error and it stops me dead in my tracks. What's funny is that you can see the range exists in the spreadsheet before your very eyes.

What's going on here?

Upvotes: 0

Views: 860

Answers (1)

Sergey S.
Sergey S.

Reputation: 6336

Looks like the names of your named ranges are not valid, they are similar to regular ranges. Try to change names

Upvotes: 2

Related Questions