Sub QuerySQLSheet()
Dim cnn As Object
Dim SQL$
Set cnn = CreateObject("ADODB.Connection")
mypath = ThisWorkbook.FullName
cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;extended properties=excel 12.0;Data Source=" & mypath
SQL = "select * from [AAA$A1:E6] where å§å='" & [l2] & "'"
'SQL = "update [AAA$] set å¹´é¾='99'where å§å='å¼ ä¸'"
'cnn.Execute (SQL)
[k5].CopyFromRecordset cnn.Execute(SQL)
cnn.Close
Set cnn = Nothing
End Sub
温馨提示:答案为网友推荐,仅供参考