View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
smartin smartin is offline
external usenet poster
 
Posts: 915
Default want to record date for each time I update a file - Excel 2007

PattyR wrote:
I want to keep track of dates that a file is updated.
The Summary only shows the last time a file was modified but I want to keep
track of each time it is modified.
Is there a way to do this?
I have MS Office Enterprise 2007.
Thanks
Patty


I dug up this code (can't recall where I got the original idea). The
functionality here is a save event will silently capture the user and
timestamp, and write the aforementioned to a worksheet called "SAVE"
(which you must create in the workbook beforehand, and hide if desired).

I can upload a workbook that demonstrates this if you like.

Watch for line-wrap:

THISWORKBOOK.CODE

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim lastrow As Range
Static IgnoreSave As Boolean

If Not IgnoreSave Then
With ThisWorkbook
With Worksheets("SAVE")
Set lastrow = .Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0)
lastrow.Value = "Saved By " _
& Environ("UserName") & " " & Now
End With
IgnoreSave = True
.Save
IgnoreSave = False
End With
End If
End Sub

END CODE<<