I have the following function that searches for a file paths, modified file date. However if my file has a wildcard at the end then this function returns a 12:00.
This is because the file with the wildcard will have many options in the path and it is not sure what value to return.
How can I tell this function to grab the max wildcard file path name.
Ex: *Stack/Over/Flow_*.csv* (a1)  will return 12:00(a2) because the actual folder will contain *Stack/Over/Flow_1.csv*, *Stack/Over/Flow_2.csv*, *Stack/Over/Flow_3.csv.*   . The work-around I have is just changing the file card path to a 1 , and it will return a proper value. But I would like the max of this wildcard.
Is it possible to return the max of whichever modified date is greater of each of these? Or do you recommend just changing the wildcard (*) to a 1 and using function as it is?
 Public Function getmodifieddateoffile(FilePath As String)
    On Error GoTo ExitWithError
    If FilePath = "" Then
        Exit Function
    End If
    If Dir(FilePath) <> "" Then
    'This creates an instance of the MS Scripting Runtime FileSystemObject class
    Set oFS = CreateObject("Scripting.FileSystemObject")
    getmodifieddateoffile = oFS.GetFile(FilePath).DateLastModified
    Else
    End If
    Exit Function
    ExitWithError:
    End Function
Any help would be greatly appreciated.
 
     
    