Sub LastSaveTime()
With ThisWorkbook
If .FullName <> vbNullString Then
.Worksheets("Sheet1").Range("A1").Value = _
FileDateTime(.FullName)
End If
End With
End Sub
This will put the last saved date and time into cell A1 on Sheet1.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting www.cpearson.com
(email on the web site)
'-----------------------------------------------------------------
Function DocProps(prop As String)
'-----------------------------------------------------------------
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function
and enter in a cell such as
=DocProps ("last author")
or
=DocProps ("last save time")
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
If you want a function that can be called from a worksheet cell, use
Function LastSaveTime(R As Range) As Date
Application.Volatile True
With R.Worksheet.Parent
If .FullName <> vbNullString Then
LastSaveTime = CDate(FileDateTime(.FullName))
End If
End With
End Function
Then call this from a cell with the formula
=LastSaveTime(A1)
The cell passed to the function doesn't matter. It is used to select the
workbook whose last save time is to be returned.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting www.cpearson.com
(email on the web site)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.