i want to import the whole path of the file C:\Users\fld but just the recent files in today for example .
Can you help me please ?
below my vba to import the path:
Sub test()
Dim fso As FileSystemObject
Dim oSourceFolder As Scripting.Folder
Dim oSubFolder As Scripting.Folder
Dim oFile As Scripting.File
Dim oFolder As Scripting.Folder
Dim strFolderName As String
Dim i As Long
Set fso = CreateObject("Scripting.FileSystemObject")
Cells(1, 1).Value = "fld"
strFolderName= "C:\Users\fld"
i = 2
Range("A2").Select
ActiveCell = Range("A2")
Set oSourceFolder = fso.GetFolder(strFolderName)
For Each oFolder In oSourceFolder.SubFolders
For Each oFile In oFolder.Files
Cells(i, 1).Value = Left(oFile.ParentFolder)
i = i + 1
Next oFile
Next oFolder