I have some ADO code within an Excel file (2003) to query data from another Excel file (see below). My question is, how do I grab data from within the same Excel file? What do I set as the connection?
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
With cn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Properties("Extended Properties").Value = "Excel 8.0"
.Open namePath & nameFile
End With
rs.Open q, cn, adOpenStatic
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
With cn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Properties("Extended Properties").Value = "Excel 8.0"
.Open namePath & nameFile
End With
rs.Open q, cn, adOpenStatic