How do I find the time that a file was last opened?
Thanks,
Sir Loin
Printable View
How do I find the time that a file was last opened?
Thanks,
Sir Loin
The easy way is to use FSO (file system object model) but better way is to use Windows API.
Here is a quick FSO sample:
VB Code:
Private Sub Command1_Click() '=============================== Dim fso As New FileSystemObject Dim oFile As File Set fldr = fso.GetFolder("c:\temp") Debug.Print "Last accessed: " & oFile.DateLastAccessed End Sub
The last accessed date is not always the date it was last opened.
If you look at the properties in explorer, the last accessed date is changed as well.
Unless the file itselve registers when it was last opened, I don't think it can be done.