象数据库一样连接EXCEL

Private Sub Command1_Click()
    Dim oConn As New ADODB.Connection
    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=C:\Book1.xls;" & _
           "Extended Properties=""Excel 8.0;"""
    oConn.Execute ("Select * into [;database=D:\Test.mdb].test1 FROM [Sheet1$]")
    oConn.Close
    Set oConn = Nothing
End Sub

你可能感兴趣的:(Excel)