ADO Recordset

T

Tim

Hi folks,

I used the following code to create ado recordset. It works but it aslo
opens another excel file. Is it possible to create ado recordset without
open a new excel instance? Or can I use currentproject.connection?

Thanks in advance.
Tim.

Sub ConnectToExcelUsingSheetName ()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\fsADOConnectExcel.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes"";"
rst.Open "SELECT * FROM [Staff List$];", cnn, adOpenStatic, adLockReadOnly
 

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