Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access id of last person to modify

Status
Not open for further replies.

jwskr

Technical User
Jul 25, 2001
4
US
Is there a function (VB perhaps) to access the id of the last user to modify a spreadsheet? Thanks to the forum, I was able to get the last date modified. This will be helpful for printed copies of spreadsheets.
 
Not sure whether last modified by is one of the file properties. You could use the before save event to keep a log of userids and date/time of workbook close. If you are on NT, then uID = environ("username") will give you the username and format(date,"dd/mm/yy hh:mm") should give you the time to the minute

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
uID = environ("username")
mDT = format(date,"dd/mm/yy hh:mm")
with sheets("UserLog")
lRow = .range("A65536").end(xlup).row
.range("A" & lRow).value = uID
.range("B" & lRow).value = mDT
end with
End Sub

This would go in teh workbook module

If you are not on NT, I can supply you with the API call to get the user id Rgds
~Geoff~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top