JerryKlmns
IS-IT--Management
I have a function retrieving the latest file on a w2000 server folder
When run it should return PROMLET041105.TXT (Modified 04-Nov-2005) and not PROMLET051005.TXT (Modified 05-Oct-2005)
The DateLastModified property using fso for PROMLET051005 is 05/10/2005 07:51:21 and for PROMLET041105 is 04/11/2005 09:23:48.
Is this normal ?
This function works fine for 3 other files.
Code:
Function FileSearching(ByVal File_Name As String, ByVal Search_Folder As String) As String
With Application.FileSearch
.NewSearch
.FileType = 1 'msoFileTypeAllFiles
.Filename = File_Name & "*.txt"
.LookIn = Search_Folder
.SearchSubFolders = False
If .Execute(4, 2, True) > 0 Then
'msoSortByLastModified, msoSortOrderDescending
FileSearching = .FoundFiles(.FoundFiles.Count)
Else
MsgBox "No File Found", vbCritical + vbOKOnly, "Error"
FileSearching = "NoFile"
End If
End With
End Function
When run it should return PROMLET041105.TXT (Modified 04-Nov-2005) and not PROMLET051005.TXT (Modified 05-Oct-2005)
The DateLastModified property using fso for PROMLET051005 is 05/10/2005 07:51:21 and for PROMLET041105 is 04/11/2005 09:23:48.
Is this normal ?
This function works fine for 3 other files.