试试这段代码,对应修改:
Sub Macro1()
Dim cnn As Object, SQL$, sh As Worksheet
Set cnn = CreateObject("ADODB.Connection")
cnn.Open "Provider = Microsoft.Jet.Oledb.4.0;Extended Properties ='Excel 8.0;hdr=no';Data Source =" & ThisWorkbook.Path & "\文档2.xls"
For Each sh In Sheets
SQL = "Select f2,f5,f6 from [" & sh.Name & "$a2:f]"
sh.Range("A2:C65536").ClearContents
sh.[a2].CopyFromRecordset cnn.Execute(SQL)
Next
cnn.Close
Set cnn = Nothing
End Sub