Recurssive Linecnt
Recurssive Linecnt
FileSystemObject
Public fldr As Scripting.Folder
Public sfldr As Scripting.Folder
Public strNames() As String
Public DSheet As Worksheet
Public m, n As Long
Sub processfiles(Pathtofolder As String)
Dim WSheet As Worksheet
Set fldr = fso.GetFolder(Pathtofolder)
Set WSheet = Worksheets("Data1")
Dim RSheet As Worksheet
Set RSheet = Worksheets("AllList")
Dim Data() As Byte
Dim text As String
With WSheet
Dim rw As Long: rw = WSheet.Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With
Dim fileNumb As Long
fileNumb = FreeFile
Dim Line As Variant
Dim Lines As Variant
Dim key As Variant
Dim Keys As Variant
Dim word1 As String
Dim cnt As Long
Dim str As String
Dim Item1 As Scripting.File
For Each Item1 In fldr.Files
With RSheet
Dim rw1 As Long: rw1 = RSheet.Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With
RSheet.Cells(rw1, 1).Value = fldr.Name
RSheet.Cells(rw1, 2).Value = Item1.Name
'rw1 = rw1 + 1
'MsgBox Item1.path
Open Item1.path For Binary Access Read As fileNumb
ReDim Data(LOF(fileNumb))
Get fileNumb, , Data
Close fileNumb
text = StrConv(Data, vbUnicode)
cnt = LineCount(Item1)
Dim x As Long
Lines = Split(text, vbCrLf)
For x = 0 To UBound(Lines)
Line = Trim(Lines(x))
If Line <> "" Then
For i = 0 To n
strNames(i) = DSheet.Range("A1").Offset(i + 1, 0)
'MsgBox strNames(i)
Dim regex As Object
Next Item1
End Sub
Sub Recursive()
Application.DisplayAlerts = False
Worksheets("AllList").delete
Sheets.Add After:=ActiveSheet
ActiveSheet.Name = "AllList"
Application.DisplayAlerts = True
processfiles ("C:\Users\70415\Documents\Euroclear\Second")