I found some code which I am trying to build up on to import Excel into an Access Table.
I have created a spreadsheet, having just one column. However the range errors, as I do not know how the range actually works. Can someone put me right, thanks
It errors on the line Range:="SheetName!AN"
I have created a spreadsheet, having just one column. However the range errors, as I do not know how the range actually works. Can someone put me right, thanks
Code:
Dim db As DAO.Database
Set db = CurrentDb
On Error Resume Next: db.TableDefs.Delete "tblImport": On Error GoTo 0
db.TableDefs.Refresh
DoCmd.TransferSpreadsheet _
TransferType:=acImport, _
SpreadsheetType:=acSpreadsheetTypeExcel9, _
TableName:="SallyImport", _
FileName:="C:\SALLY1.xlsX", _
HasFieldNames:=True, _
Range:="SheetName!A:DN"
db.TableDefs.Refresh
db.Close: Set db = Nothing
It errors on the line Range:="SheetName!AN"