Locking =Today() on Save as on Template

R

Ross Thomson

Hi Folks,
I have a Excel Template with a =today() cell to show todays date when
opened - but would like have the date shown when the file was saved, not
todays date?
 
G

Gord Dibben

Private Sub Workbook_BeforeSave(ByVal SaveAsUI _
As Boolean, Cancel As Boolean)
If ThisWorkbook.Path = "" Then
Sheets("Sheet1").Range("A1").Value = "Last Saved On " & _
Format(Date, "mm/dd/yyy")
End Sub

Placed in Thisworkbook module of the Template which I assume is a true *.XLT
template


Gord Dibben MS Excel MVP
 
G

Gord Dibben

Forgot the End If

End If
End Sub


Gord

Private Sub Workbook_BeforeSave(ByVal SaveAsUI _
As Boolean, Cancel As Boolean)
If ThisWorkbook.Path = "" Then
Sheets("Sheet1").Range("A1").Value = "Last Saved On " & _
Format(Date, "mm/dd/yyy")
End Sub

Placed in Thisworkbook module of the Template which I assume is a true *.XLT
template


Gord Dibben MS Excel MVP
 

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