Creation date vs today's date


Posted by Ron Hoskin on August 08, 2000 3:01 AM

I have a template workbook that I use frequently and then regularly update it.
I'd like to include in two specific cells :
1. The date the file was first created and
2. The date the file was updated - for this today() works fine.

Can anyone make a suggestion for a function or macro that will produce a 'creation date', the same as
CREATEDATE field in WORD ?

thanks
Ron

Posted by Doughboy on August 08, 0100 3:26 AM

1st response

When do you want the date updated when it is saved?
I understand what your are asking but I don't at the same time.
if it it when Saved put this code in the thisworkbook
if a1 is today then it should replace today with the date. It is crude but works.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range("A1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End Sub

Posted by Ivan Moala on August 08, 0100 4:01 AM

Ron
Have a look @ Johns site for the correct
creation date of a file;
http://www.j-walk.com/ss/excel/tips/tip57.htm

If you require help on adjusting this then post.


Ivan

Posted by Ron Hoskin on August 10, 0100 4:17 AM




Posted by Ron Hoskin on August 10, 0100 4:25 AM

Ivan/ Doughboy
Thanks for your posts, got me on the right track.
Here's what I came up with. Actually even the createdate variable is unnecessary, as all I have to do is check that the cell in the newly created file is empty and add the current date. The next time the file is opened another cell can contain today() or now() to give me the date of the update.
Ron


Public Sub test3()
Dim createdate As String
createdate = ActiveWorkbook.BuiltinDocumentProperties.Item _
("Creation date").Value
Range("b3") = "File created (first saved) on"
Range("b4") = "File updated on"
If IsEmpty(Range("c3")) Then
Range("C3").Value = Format(createdate, "dd/mm/yy")
End If
Range("c4").Value = Format(Now, "dd/mm/yy")
End Sub