|
Sub test()
Dim cnn As Object
Dim rs As Object
Dim sht As Worksheet
Dim MySQL As String
Set cnn = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
cnn.Open "provider=microsoft.ace.oledb.12.0;extended properties='Excel 12.0;HDR=yes;IMEX=0';data source=" & ThisWorkbook.FullName
For Each sh In Sheets
If sh.Name <> "数据" Then
MySQL = "update [数据$a5:k]a,[" & sh.Name & "$a5:g]b " _
& "set b.产量系数=a.产量系数,b.废品系数=a.废品系数,b.工序=a.工序,b.分类=a.分类 where a.工时简称=b.工时简称"
rs.Open MySQL, cnn, 1, 3
MySQL = ""
End If
Next
End Sub
|
|