Retrieve data from EXCEL to ACCESS in Office2007

M

Manuelauch

The codes below work in ACCESS 2003, but do not work in ACCESS 2007. I use it
to retrieve the data from EXCEL to ACCESS , butt failed in cnNet.Open line of
code

stFilePathAndName = "C\TEMP\Test.xls"
cnNet.Provider = "Microsoft OLE DB Provider for ODBC Drivers"

cnNet.ConnectionString = "DRIVER={Microsoft Excel Driver (*.xls)};DBQ="
& stFilePathAndName & ";"
cnNet.Open
cnNet.CursorLocation = adUseClient
'Rage in the EXCEL file is PARAMETER_RANGE
Set rstNet = cnNet.Execute("PARAMETER_RANGE")
 
K

Klatuu

Look in VBA Help for info on the TransferSpreadsheet method. That is what is
commonly used to export data from Access to Excel or from Excel to Access.
 

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