Hello,
With Excel2010, I'm trying to open a Named Range (in the same workbook) with ADODB recordset.
I get the following error when the try to open the recordset
'Run-time error' -2147217865 (80040e37)': Automation error
This is the code I'm using:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
strFile = ThisWorkbook.FullName
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
strCon = "Provider=Microsoft.ACE.OLEDB.12.0; " & _
"Data Source=" & strFile & ";Extended Properties=""Excel 12.0 Macro;HDR=Yes"";"
cn.Open strCon
SQL = "SELECT * FROM [MyRange]"
rs.Open SQL, cn
thanks in advance
Márcio
Bookmarks