Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function FindLastFile(File_Name As String, Search_Folder As String) As String
Dim rst As ADODB.Recordset
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder(Search_Folder)
Set fls = folder.files
Set rst = New ADODB.Recordset
With rst
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockBatchOptimistic
.Fields.Append "Name", adVarChar, 252
.Open
For Each fl In fls
.AddNew
.Fields("Name") = fl.Name
Next
.UpdateBatch
.Filter "Name = " & File_Name & "???.doc"
.Sort = "Name"
If .EOF And .BOF Then
FindLastFile = "Not Found" ' Handle this error!
Else
.MoveLast
FindLastFile = .Fields("Name")
End If
.Close
End With
Set rst = Nothing
End Function