|
Sub m2()
Dim f As String, s() As String, i As Long, t As Long, arr(10000, 2)
t = 0
f = Dir(ThisWorkbook.Path & "\*.txt")
While f > ""
Open ThisWorkbook.Path & "\" & f For Input As #1
s = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf)
Close #1
arr(t, 0) = Split(f, ".")(0)
For i = 0 To UBound(s)
t = t + 1
arr(t, 1) = s(i)
Next
t = t + 1
f = Dir
Wend
Range("A:B").ClearContents
Range("A1").Resize(10000, 2) = arr
MsgBox "OK"
End Sub |
|