This should get you started.
Gives Name, BeginBalance and EndingBalance for each file in directory.
Code:
Sub ReadTextFiles()
'Set Reference to Microsoft Scripting Runtime (Tools > References)
Const TextDir = "G:\My documents\TextFiles\" 'adjust accordingly
Dim FSO As FileSystemObject, FSOStream As TextStream
NumFiles = Format(CreateObject("scripting.filesystemobject") _
.GetFolder(TextDir).Files.Count, "0000")
ReDim sn(1 To NumFiles, 1 To 3)
Set FSO = New FileSystemObject
fn = Dir(TextDir & "*.txt")
i = 1
Do While fn <> ""
Set FSOStream = FSO.GetFile(TextDir & fn) _
.OpenAsTextStream(ForReading, TristateUseDefault)
sn(i, 1) = fn
sn(i, 2) = Split(FSOStream.ReadLine, ",")(8)
sn(i, 3) = Split(FSOStream.ReadLine, ",")(8)
fn = Dir()
i = i + 1
Loop
With Sheets(1).Cells(1) 'puts data in 1st sheet, change to need
.CurrentRegion.ClearContents
.Resize(UBound(sn, 1), UBound(sn, 2)) = sn
End With
End Sub
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
Bookmarks