|
Sub limonet()
Dim Cat As Object, ObjTable As Object, Path$, FileName$, Arr() As Variant, i%
Set Cat = CreateObject("ADOX.Catalog")
Path = ThisWorkbook.Path & "\文件夹\"
FileName = Dir(Path & "*.xls?")
Do While FileName <> ""
j = j + 1: i = 0
Cat.ActiveConnection = "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=Excel 12.0;Data Source=" & Path & FileName
For Each ObjTable In Cat.Tables
If Not ObjTable.Name Like "*FilterDatabase" And ObjTable.Type = "TABLE" Then i = i + 1
Next ObjTable
ReDim Preserve Arr(1 To 2, 1 To j): Arr(1, j) = FileName: Arr(2, j) = i
FileName = Dir
Loop
Range("A2").Resize(UBound(Arr, 2), 2) = Application.Transpose(Arr)
End Sub |
评分
-
1
查看全部评分
-
|