#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,069
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Last Modified Emma Hope Excel Worksheet Functions 3 July 19th 06 09:06 PM
Display date modified Curious Excel Discussion (Misc queries) 2 July 13th 06 12:34 PM
Date last modified - for entire workbook AndrewPace Excel Discussion (Misc queries) 3 July 11th 06 08:38 PM
output date modified if data is entered for multiple rows [email protected] Excel Discussion (Misc queries) 4 October 13th 05 08:09 PM
How do I enter the date last modified in the footer of an Excel d. Last modified date in footer Excel Discussion (Misc queries) 1 February 6th 05 11:12 PM


All times are GMT +1. The time now is 06:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"