如果写VBS:
Sub a()
Dim fso
Dim fld
Dim fil
Dim xls
Dim bok
Dim sht
Dim i
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder("C:\Users\king\Documents\")
Set xls = CreateObject("Excel.Application")
i = 1
For Each fil In fld.Files
If LCase(Right(fil.Name, 4)) = ".xls" Or LCase(Right(fil.Name, 5)) = ".xlsx" Then
Debug.Print (fil.Name)
i = i + 1
Set bok = xls.Workbooks.Open(fil.Path, ReadOnly = True)
Set sht = bok.Sheets(1)
Sheet1.Cells(i, 1).Value = fil.Name
Sheet1.Cells(i, 2).Value = sht.Evaluate("=COUNTIF(B:B,""PASS"")")
Sheet1.Cells(i, 3).Value = sht.Evaluate("=COUNTIF(B:B,""dead"")")
Sheet1.Cells(i, 4).Value = sht.Evaluate("=COUNTIF(B:B,""DLD dead"")")
bok.Close
End If
Next
End Sub