I have this code below.......and I want it to return the filename on the last modified file in the folder I have defined. My messagebox in the end just returns "false".......and I had hoped it would return some kind of filename. Could anyone tell me how I can rewrite my code in order to make it show the filename?
Code
Sub hentUbs()
Findes
End Sub
Function Findes() As Boolean
' Uses FileSerach object
Dim fname As Variant
Directory = "U:\FI-Euro\IG Corporates\HF\Tool Construction\UBS"
With Application.FileSearch
.NewSearch
.Filename = fname
.LookIn = Directory
.LastModified = msoLastModifiedAnyTime
.Execute
Findes = fname
End With
MsgBox Findes
End Function
Display More
Thanks, Lars