First login & last Logout

V

Vikky

Hi Experts;


I need to make a report of first login & Last logout time.

Please help me.

Sample Data:--
===========
Agent Logged In Time Logged Out Time

103134 - Verma, Naveen 8/16/2006 4:11:11 PM 8/16/2006 9:07:59 PM
103134 - Verma, Naveen 8/16/2006 9:12:20 PM 8/17/2006 12:03:36 AM
104226 - Sehgal, Rajiv 8/16/2006 4:49:48 PM 8/16/2006 5:01:16 PM
104272 - Gupta, Ruchi 8/16/2006 4:13:37 PM 8/16/2006 5:13:11 PM
104272 - Gupta, Ruchi 8/16/2006 5:15:24 PM 8/16/2006 9:00:59 PM
104272 - Gupta, Ruchi 8/16/2006 9:13:11 PM 8/16/2006 9:13:30 PM
104272 - Gupta, Ruchi 8/16/2006 9:17:20 PM 8/17/2006 12:03:31 AM
104510 - P Samuel, Christina 8/16/2006 4:11:31 PM 8/16/2006 11:24:03
PM
104510 - P Samuel, Christina 8/16/2006 11:27:39 PM 8/17/2006 12:04:03
AM
104571 - Verma, Puneet 8/16/2006 4:08:45 PM 8/16/2006 4:17:06 PM
104571 - Verma, Puneet 8/16/2006 4:17:33 PM 8/16/2006 5:35:12 PM
104571 - Verma, Puneet 8/16/2006 5:36:02 PM 8/17/2006 12:04:04 AM
104668 - Bhutani, Gaurav 8/16/2006 4:16:58 PM 8/16/2006 5:17:44 PM
104668 - Bhutani, Gaurav 8/16/2006 5:19:01 PM 8/16/2006 6:01:50 PM


Thanks.

Regards;
Vikky
 
B

Bob Phillips

You should be able to do something with this

Option Explicit

Const LOG_FILENAME As String = "LogFile.txt"

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim iFile As Long

iFile = FreeFile
Open ThisWorkbook.Path & "\" & LOG_FILENAME For Append As #iFile
Print #iFile, ThisWorkbook.Name & " logged in at " & _
Format(Now, "dd-mmm-yyyy hh:mm:ss")
Close #iFile
End Sub

Private Sub Workbook_Open()
Dim iFile As Long

iFile = FreeFile
Open ThisWorkbook.Path & "\" & LOG_FILENAME For Append As #iFile
Print #iFile, ThisWorkbook.Name & " logged out at " & _
Format(Now, "dd-mmm-yyyy hh:mm:ss")
Close #iFile

End Sub

This is workbook event code.
To input this code, right click on the Excel icon on the worksheet
(or next to the File menu if you maximise your workbooks),
select View Code from the menu, and paste the code



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
V

Vikky

Thank you Bob for your help. I'll do the same if find any problem ,i'll
get back to you.

Regards;

Vikky
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top