Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Last Modified
I am looking for a way for excel to auto add the last modified date and time
as well as the user. I would like the date and time in one cell and the user in a seperate cell. Is this something that can be done fairly easily? Any help is always appreciated. Thanks, Steve |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Last Modified
You will need VBA for this. Copy the following into a VBA code module, to get
the user's ID from the network (not guaranteed to work on every kind of network): 'Declare API functions Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Public Function ReturnUserName() As String 'Returns the NT Domain User Name Dim rString As String * 255, sLen As Long, tString As String tString = "" On Error Resume Next sLen = GetUserName(rString, 255) sLen = InStr(1, rString, Chr(0)) If sLen 0 Then tString = Left(rString, sLen - 1) Else tString = rString End If On Error GoTo 0 ReturnUserName = UCase(Trim(tString)) End Function In the ThisWorkbook module, add a Workbook_BeforeSave event routine like the following: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Range("A4").Value = Now() Range("A5").Value = ReturnUserName() End Sub Hope this helps, Hutch "Steve" wrote: I am looking for a way for excel to auto add the last modified date and time as well as the user. I would like the date and time in one cell and the user in a seperate cell. Is this something that can be done fairly easily? Any help is always appreciated. Thanks, Steve |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date Last Modified | Excel Worksheet Functions | |||
Display date modified | Excel Discussion (Misc queries) | |||
Date last modified - for entire workbook | Excel Discussion (Misc queries) | |||
output date modified if data is entered for multiple rows | Excel Discussion (Misc queries) | |||
How do I enter the date last modified in the footer of an Excel d. | Excel Discussion (Misc queries) |