用Data控件设置后可以直接使用,过去我用过.

解决方案 »

  1.   

    设置Connect属性为Excel8.0
    设置DatabaseName 
      

  2.   

    用ODBC建一数据源,其驱动程序选择Microsoft Excel Driver(*.xls) ......按提示建立;设置ADO Data控件或Connection对象的ConnectionString为"DSN=新建数据源名"(或做相关操作),之后就可像操作数据库一样操作它
      

  3.   

    可以使用DAO,不过Excel数据库是之允许添加、修改、浏览而不允许删除行的:(Sub TestHDRConnectParameter(blnHDRParam As Boolean)
    Dim dbs As Database
    Dim rst As Recordset
    Dim strHDRParam As String If blnHDRParam = True Then
    strHDRParam = "YES"
    Else
    strHDRParam = "NO"
    End If ' Open the Microsoft Jet sample database.
    Set dbs = OpenDatabase("C:\JetBook\Samples\Excel\Products97.xls", _
    False, False, "Excel 8.0;HDR=" & strHDRParam & ";") ' Create a Recordset object for the Microsoft Excel Products worksheet.
    Set rst = dbs.OpenRecordset("Products$") ' Move to the last record and display the RecordCount property value.
    With rst
    .MoveLast
    MsgBox "There are " & .RecordCount & " records in this worksheet."
    .Close
    End With
    dbs.Close
    End Sub注意:
    (1)HDR指定是否将首行作为标题行。
    (2)表名字后面要加$符号。