A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Try this... You will want to swap out the message box at the end with a file open line...
Sub Read_Dir()
Dim ofile As Object
Dim dteMax As Date
Dim oFoundFile As Object
Dim oFold As Object
Dim FSO As Object
Set FSO = CreateObject("scripting.filesystemobject")
'change folder to suit
Set oFold = FSO.GetFolder("H:")
For Each ofile In oFold.Files
With ofile
If .Type = "Microsoft Excel Worksheet" Then
If .datelastmodified > dteMax Then
Set oFoundFile = ofile
dteMax = .datelastmodified
End If
End If
End With
Next ofile
MsgBox oFoundFile.Path
Set FSO = Nothing
End Sub
If this post answers your question, please mark it as the Answer... Jim Thomlinson
