Link to home
Create AccountLog in
Avatar of needhelpfast569
needhelpfast569

asked on

Import excel into access using code

Hi experts,

Have a problem that I hope you can help with. I have a access application that has to have to versions access 2003 and access 2007. I export to a excel file using the following statement

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "SurveyExportFile", ThisDir & FldVal & "SurveyExportFile.xls", True

and import a excel file using the following statement

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "SurveyExportFileImport", pathNmeStr

Both of these statements work great in the access 2003 version using excel 2003 format.

But the same statements in access 2007 does not work for the import

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "SurveyExportFileImport", pathNmeStr

I have tried changing the acSpreadsheetTypeExcel but no luck I get the error

Runtime error 3170  Could not find installable ISAM

Looking at several blogs I get the feeling that access 2007 does not want to import execl 2003 files.

If I get a copy of excel 2007 and use that with the access 2007 with that fix the problem, since most people would have excel 2007 if they are using access 2007.

Also if I export and import excel 2007 files in access 2007 what acSpreadsheetTypeExcel version do I use?

Thanks for any help.
Avatar of needhelpfast569
needhelpfast569

ASKER

sorry for the misspelling that was two versions of access
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
THanks that worked!!!! Thanks again