Open a worksheet through OLEDB : Microsoft Jet « Access « VBA / Excel / Access / Word






Open a worksheet through OLEDB

 
Sub openWorksheet()
   Dim myConnection As New ADODB.Connection
   Dim myRecordset As ADODB.Recordset
   
   myConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
             "Data Source=C:\Customers.xls;" & _
             "Extended Properties=Excel 8.0;"
   
   Set myRecordset = New ADODB.Recordset
   myRecordset.Open "customers", myConnection, , , adCmdTable
   
   Do Until myRecordset.EOF
      Debug.Print myRecordset("txtCustNumber"), myRecordset("txtBookPurchased")
      myRecordset.MoveNext
   Loop
End Sub

 








Related examples in the same category

1.Include the database version information with the JetOLEDB:Engine Type property
2.connect to JET
3.Read table schema
4.Connection String to Access database
5.Use Recordset.Support to check the supported features
6.Create new database
7.Opening a Microsoft Jet Database in Read/Write Mode
8.Sub addJetSqlUser()
9.A Simple Connection Example