Hello,

I am adding a list of file names to a combobox list and want to filter this by adding only the filenames that have been modified today. I have used the FileDateTime(Fil) but it leaves the combobox empty. I am using the code below thanks to a post from RoyUK, but cannot figure out how to add only the files modified today.

Any help would be greatly appreciated.

Option Explicit 
 
Private Sub UserForm_Initialize() 
     'Files in folder listed in Listbox1
    Dim FSO As Object, fld As Object, Fil As Object 
    Dim SubFolderName As String 
    Dim i As Integer 
    Set FSO = CreateObject("Scripting.FileSystemObject") 
    Me.ListBox1.Clear 'clear previous entries
    SubFolderName = "C:\Scripts" 
    Set fld = FSO.GetFolder(SubFolderName) 
    For Each Fil In fld.Files 
        i = i + 1 
        Me.ListBox1.AddItem Fil.Name 
         
    Next Fil 
 End Sub