- Sub Test_Excel()
- Dim cn As New ADODB.Connection
- Dim rs As New ADODB.Recordset
- cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
- "Data Source=C:\Book1.xls;" & _
- "Extended Properties=""Excel 8.0;"
- rs.Open "Select * from [Sheet1$]", cn, adOpenStatic
-
- ' 或者通过OLE
- Dim xl As Excel.Application
- Set xl = CreateObject("Excel.Application")
- End Sub
- Sub Test_Access()
- Dim cn As New ADODB.Connection
- Dim rs As New ADODB.Recordset
- cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
- "Data Source=C:\db1.mdb;"
- rs.Open "Select * from Table", cn, adOpenStatic
-
- ' 或者通过OLE
- Dim ac As Access.Application
- Set ac = CreateObject("Access.Application")
- End Sub
|