参与一下。。。
- Sub ykcbf() '//2024.4.9
- Set fso = CreateObject("scripting.filesystemobject")
- Application.ScreenUpdating = False
- Set sh = ThisWorkbook.Sheets("Sheet1")
- p = ThisWorkbook.Path & ""
- ReDim brr(1 To 10000, 1 To 5)
- For Each f In fso.GetFolder(p).Files
- If LCase(f.Name) Like "*.txt" Then
- fn = fso.GetBaseName(f)
- arr = Split(ReadUTFText(f), vbCrLf)
- For i = 0 To UBound(arr) Step 8
- m = m + 1
- brr(m, 1) = fn
- brr(m, 2) = arr(i)
- brr(m, 3) = Replace(Split(arr(i + 4), "=")(1), "Ω", "")
- brr(m, 4) = Replace(Split(arr(i + 5), "=")(1), "Ω", "")
- brr(m, 5) = Replace(Split(arr(i + 6), "=")(1), "Ω", "")
- Next
- End If
- Next f
- With sh
- .UsedRange.Offset(1) = ""
- .[a2].Resize(m, 5) = brr
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|