请问兰版主: 运行下面这段代码除了引用ado外,还需应用什么 我运行时提示“自动化错误” Sub ¾ØÐÎ12_µ¥»÷()
Dim CNN As New ADODB.Connection
Dim RST As New ADODB.Recordset
Dim Stpath, strSQL As String
Stpath = ThisWorkbook.Path & Application.PathSeparator & "µç×ÓÁìÁϱí.mdb"
CNN.Open "provider=Microsoft.jet.OLEDB.4.0;data source=" & Stpath '& ";Jet OLEDB:Database Password=" & "123" strSQL = "SELECT ¹¤³ÌÃû³Æ,¿ªÆ±ÈÕÆÚ,sum(×ܼÛ) FROM ×ܱí GROUP BY ¹¤³ÌÃû³Æ,¿ªÆ±ÈÕÆÚ" RST.Open strSQL, CNN
Sheet1.Range("A2:G100").ClearContents
Sheet1.Cells(2, 1).CopyFromRecordset RST
RST.Close
Set RST = Nothing
Set CNN = Nothing
End Sub
|