I am trying to display the last person who accessed excel file and time in excel sheet but the file name changes every day (file name contains date).
My current codes gives me an error of file not found which I tried both ActiveWorkbook.path
and Application.ActiveWorkbook.Path
.
Sub Main()
'Setting Summary Report
Dim sAuthor As String
sAuthor = ActiveWorkbook.BuiltinDocumentProperties("Last Author")
'Last modified person & time
Dim fileModDate As String
Dim fs
Dim f
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(Application.ActiveWorkbook.Path)
fileModDate = f.DateLastModified
Worksheets("Sheet1").Range("A2") = sAuthor & " " & fileModDate
End Sub
I could re-save the file as an uniform name like test or something, but I wasn't sure if the codes can be modified for this to work so I don't have to re-save the file.