date last modified

J

JD

Hi

Have had a look around the net for a solution - they are a few around but I
can't seem to get them to work

I need to put the date last modified either in a cell or as a footer - can
anyone help? I am running excel 2007

thanks
 
G

Gary''s Student

Try this User Defined FUnction:

Function lastsaved() As Double
lastsaved = ActiveWorkbook.BuiltinDocumentProperties(12)
End Function
 
B

Bob Phillips

'-----------------------------------------------------------------
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")
 
J

JD

OK - so from the excel sheet, I pressed alt F11 and then pasted the code
into the module1. Then from the spreadsheet, I put =lastsaved in the cell -
it says #?Name

What am I doing wrong?

thanks for your help
 
G

Gary''s Student

We are almost there!

In the worksheet, instead of:
=lastsaved
use:
=lastsaved()


and make sure it has already been saved!
 
J

JD

hmm

now I get #REF!

any more ideas????

Gary''s Student said:
We are almost there!

In the worksheet, instead of:
=lastsaved
use:
=lastsaved()


and make sure it has already been saved!
 
J

JD

Thanks for trying - managed to get this to work:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
For Each Sheet In ThisWorkbook.Sheets
Sheet.PageSetup.LeftFooter = "Last saved: " & Format(Date, "dd-mm-yy") & " "
& Time
Next Sheet
End Sub

this adds to the footer
 

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