PDA

View Full Version : [SOLVED] Last Saved Information



MWE
08-22-2008, 07:50 PM
How do I determine when (date and time) the active workbook was last saved? I have poked around in BuiltInDocumentProperties, but can only find "Creation Date" and that value is bogus, i.e., it is the date the file was last opened, not when created or when last saved (why are all dates in docprops in Excel wrong?)

rbrhodes
08-22-2008, 09:10 PM
Hi MWE, Perhaps create your own timestamp:



Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("Sheet1").Range("A1") = Now()
End Sub

MWE
08-22-2008, 10:03 PM
Hi MWE, Perhaps create your own timestamp:


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

Sheets("Sheet1").Range("A1") = Now()

End Sub
thanks for the reply; interesting approach

Bob Phillips
08-23-2008, 04:45 AM
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 save time")

MWE
08-23-2008, 08:25 AM
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 save time")
thanks for the reply. Now I realize why my previous attempts failed. For some reason, I was using
ActiveWorkbook.BuiltinDocumentProperties( "last time saved") instead of
ActiveWorkbook.BuiltinDocumentProperties( "last save time") :banghead: