呵呵,马后炮我也放一个:
Tables("表A").StopRedraw()
DataTables("表A").DataRows.clear
For Each fl As String In FileSys.GetFiles("c:\tt")
Dim Book As New XLS.Book(fl)
Dim Sheet As XLS.Sheet = Book.Sheets(0)
For n As Integer = 1 To Sheet.Rows.Count -1
Dim r As DataRow
If DataTables("表A").DataRows.Count >= n Then
r = DataTables("表A").DataRows(n-1)
Else
r = DataTables("表A").AddNew
End If
For m As Integer = 0 To sheet.Cols.Count - 1
r(sheet(0,m).Text) = Sheet(n,m).Value
Next
Next
Next
Tables("表A").ResumeRedraw()