I have the following code to list all files in a folder
I have tried to amend this to list all files in the folder and sub-folder C:\extract for eg C:\extract\TBBr1 containing the name Man(P) in the workbook name
Your assistance in resolving this is most appreciated
I have tried to amend this to list all files in the folder and sub-folder C:\extract for eg C:\extract\TBBr1 containing the name Man(P) in the workbook name
Your assistance in resolving this is most appreciated
Code:
Sub ListFilesinFolder()
Sheets("Sheet1").Select
Range("A1:C150").ClearContents
Dim fso As Object, Fld As Object, fPath As String, Ct As Long
Set fso = CreateObject("Scripting.Filesystemobject")
fPath = "C:\extract"
Set Fld = fso.getfolder(fPath).Files
Application.ScreenUpdating = False
Range("A1:C1").Value = Array("File Name", "Created", "Last Modified")
For Each F In Fld
Ct = Ct + 1
Range("A1").Offset(Ct).Value = F.Name
Range("B1").Offset(Ct).Value = F.datecreated
On Error Resume Next
Range("C1").Offset(Ct).Value = F.DateLastModified
On Error GoTo 0
Next F
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:=".", FieldInfo:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
Columns("B:B").Delete
Columns("A:C").AutoFit
Application.ScreenUpdating = True
End Sub