My current function checks a file path and returns its timestamp, ex: A1 has Oz/Grid.csv, use the function in B1 and get the time it was created.
However if my file is Oz/Grid_*.csv in A1 , the function returns a default value , im guessing because there are many files that the wildcard could apply to . So because the wildcard checks for every file with that name and usually the folder that contains the file I look for has file names such as Oz/Grid_1.csv , Oz/Grid_2.csv, etc.
How can I get this function to search for the max wildcard value and return that instead of returning a default value?
Public Function getTimestampOfFile(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") getTimestampOfFile = oFS.GetFile(FilePath).DateCreated Else End If Exit Function ExitWithError: End Function
any help would be greatly appreciated.