Importing Excel Sheet into Access Database using VBA

F

fokruls

hi,

i am using the transferspreadsheet:

DoCmd.TransferSpreadsheet transfertype:=acImport, _
tableName:=tableName, _
fileName:=fileName, Hasfieldnames:=True, _
Range:="'IT all'!",
SpreadsheetType:=acSpreadsheetTypeExcel9

I want to import a sheet called IT all from an Excel file. However it
is telling me that the IT all$ is not a valid name

Any ideas how can can do this?

Thanks in advance
 
J

John Nurick

Try "'IT all'$" or "[IT all]$".

If that fails, create a named range covering the cells you want to import
data from. Use a name that doesn't contain spaces, e.g. "IT_all" and pass
this to TransferSpreadsheet *without* using a ! or $.
 
F

fokruls

Thats done it!!!!

Thanks John!!

Your a hero!!


Try "'IT all'$" or "[IT all]$".

If that fails, create a named range covering the cells you want to import
data from. Use a name that doesn't contain spaces, e.g. "IT_all" and pass
this to TransferSpreadsheet *without* using a ! or $.

--
John Nurick
Microsoft Access MVP



i am using the transferspreadsheet:
DoCmd.TransferSpreadsheet transfertype:=acImport, _
tableName:=tableName, _
fileName:=fileName, Hasfieldnames:=True, _
Range:="'IT all'!",
SpreadsheetType:=acSpreadsheetTypeExcel9
I want to import a sheet called IT all from an Excel file. However it
is telling me that the IT all$ is not a valid name
Any ideas how can can do this?
Thanks in advance- Hide quoted text -- Show quoted text -
 

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