|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub connec()
Dim con As New ADODB.Connection
con.Open "provider=microsoft.ace.oledb.12.0;extended properties=excel 12.0; data source= " & Sheet1.TextBox1.Value
Dim sql
sql = "select [Lot ID],Location from [diebank$A3:AI],[shopfloor$A3:AC] where [Lot ID]=" & cells(6,1)
Dim fil As New ADODB.Recordset
Set fil = con.Execute(sql)
For i = 0 To fil.Fields.Count - 1
Sheets(1).Cells(5, i + 5) = fil.Fields(i).Name
Next
Sheets(1).[e6].CopyFromRecordset fil
con.Close
Set con = Nothing
End Sub
帮忙看看问题出在哪里。。。。
|
|