Enter Date Last Modified Date in Cell

P

Paul Moles

Ron de Bruin provided code to enter the last saved date.

Sub Auto_Open()
aa = ActiveWorkbook.BuiltinDocumentProperties("Last Save
Time")
UserName = Environ$("UserName")
ThisWorkbook.Sheets("sheet1").Range("a1").Value = aa
ThisWorkbook.Sheets("sheet1").Range("a2").Value = UserName
End Sub

Is there any way to modify this code or where it is stored
to reflect the date last modified, rather than date last
saved?

Unfortunately running the code means the file has been
updated changing the last modified date prompting user to
save changes on exit. When the actual data contained
within the file may have only been viewed and not amended.

Alternatively is there some other way I might get the Date
last modified into a cell to avoid versioning problems,
with frequently viewed but less frequently modified files.

Many Thanks
Paul Moles
 
P

Paul Moles

A further look round found Frank Kabel suggestion

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

Now you can use the following formula in one of your cells:
=DocProps("Last save time")

Apologies for premature posting. Paul Moles
 

Ask a Question

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.

Ask a Question

Top