Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel workbook time log

Hi - I'm trying to create a workbook template that will log when a
user opens a workbook, and what time they close the document, to give
folks an idea of how much time they spend in a given worksheet. Time
management data, if you will.

(I know the flaw in the logic is that having a workbook open doesn't
mean they're working in it, necessarily, but it's a first step toward
document management, anyway.)

The idea is to use the NOW() and Auto_Open (or Workbook_Open)
functions, and paste the value from the NOW() on a sheet upon open and
exit, but not having a great deal of success figuring out how to
create a timestamp or echo the username.

Any assistance is appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default excel workbook time log

Use this function to get the username:
Public Declare Function GetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function OSGetUserName2() As String
On Error GoTo myend
Dim strBuff As String * 25
Dim strName As String
Dim lngX As Long
lngX = GetUserName(strBuff, 25)
OSGetUserName2 = strBuff
If (Len(OSGetUserName2) = 0) Then OSGetUserName2 = "unknown"
myend:
End Function

Then you just need to write to the sheet. Something like
Sub foo()
With Sheets("TimeSheet")
.[a1].Value = OSGetUserName2
.[b1].Value = Now()
End With
End Sub

Of course, this will need to be tweaked to get the result you are
after, but it should get you headed in the right direction.

HTH
-Jeff-


wrote:
Hi - I'm trying to create a workbook template that will log when a
user opens a workbook, and what time they close the document, to give
folks an idea of how much time they spend in a given worksheet. Time
management data, if you will.

(I know the flaw in the logic is that having a workbook open doesn't
mean they're working in it, necessarily, but it's a first step toward
document management, anyway.)

The idea is to use the NOW() and Auto_Open (or Workbook_Open)
functions, and paste the value from the NOW() on a sheet upon open and
exit, but not having a great deal of success figuring out how to
create a timestamp or echo the username.

Any assistance is appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default excel workbook time log

If the User Name from the Tools|Option dialog box is wanted (General
tab), then you could simply use:

Application.UserName

Only caveat is that some users only enter their initials, or something
else, like "C3PO", if they are a Star Trek fan! (Grin!)
--
Regards,
Bill Renaud



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
How do I look at two worksheets in one Excel workbook at same time PeoriaJean Excel Discussion (Misc queries) 2 June 4th 10 08:23 PM
Able to open same excel workbook at the same time ! ann[_3_] Excel Programming 4 May 10th 06 01:46 PM
Excel workbook to be used by multiple users at same time....possible??? malik641 Excel Worksheet Functions 1 June 26th 05 01:45 AM
Why does Excel 2003 open on 3rd tab of workbook every time, not l. Excelfrustrated Excel Worksheet Functions 2 February 7th 05 08:15 PM
Excel Workbook opens after a very very long time Excel Worksheet Functions 2 December 18th 04 11:15 AM


All times are GMT +1. The time now is 12:38 PM.

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"