|
Dim cnn As New Connection
Dim rs As New Recordset
Dim sql As String
Dim x%
t = 2
For Each n In dic
If n <> ThisWorkbook.Name Then
cnn.Open "Provider=Microsoft.Ace.OleDB.12.0;extended properties=excel 8.0;data Source=" & ThisWorkbook.Path & "\" & n
sql = "select * from [表2医院月报表$a4:f10]"
rs.Open sql, cnn
Sheet2.Range("a" & t).Offset(0, 0).CopyFromRecordset rs
For i = 0 To 5
sheet2.Cells(t + i, 7) ='表2医院月报表$a1
Next
t = t + 6
rs.Close
cnn.Close
End If
Next
这个 取同文件夹下各不同excel中a4:f10区域文件到当前excel中,其中红字部份是单位名称,我不知道如何用ado取出这个数!求各位
|
|