All
I am using Access 2007 and I need to create an ADODB-connection to a specific Excel worksheet. The worksheet is in the XLSX-format and the installed Excel version is also 2007. The name of the worksheet is shtImport. The complete "Office 2007 Enterprise"-suite is installed on the computer. The XLSX does contain the worksheet shtImport
The connection to the XLSX succeeds, but on rsXLS.Open I get the errormessage: The microsoft Office Access database engine could not find the object 'shtImport'...
Can someone help me?
Regards
Ino
I am using Access 2007 and I need to create an ADODB-connection to a specific Excel worksheet. The worksheet is in the XLSX-format and the installed Excel version is also 2007. The name of the worksheet is shtImport. The complete "Office 2007 Enterprise"-suite is installed on the computer. The XLSX does contain the worksheet shtImport
Code:
strOpenFilename = "c:\test\workbook.xlsx"
strSQL = "select * from shtImport"
Set cnXLS = New ADODB.Connection
cnXLS.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strOpenFilename & ";Extended Properties=""Excel 12.0 Xml;HDR=YES"";"
Set rsXLS = New ADODB.Recordset
rsXLS.Open strSQL, cnXLS, adOpenDynamic, adLockOptimistic
rsXLS.MoveFirst
The connection to the XLSX succeeds, but on rsXLS.Open I get the errormessage: The microsoft Office Access database engine could not find the object 'shtImport'...
Can someone help me?
Regards
Ino