ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   want to record date for each time I update a file - Excel 2007 (https://www.excelbanter.com/excel-discussion-misc-queries/232275-want-record-date-each-time-i-update-file-excel-2007-a.html)

PattyR

want to record date for each time I update a file - Excel 2007
 
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

--
You can always teach an old dog new tricks.

smartin

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<<

PattyR

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<<


Hi
Could you please tell me where to enter the code? I've never dealth with
macros in Excel before.
Thanks
Patty


All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com