• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Log In Log Out (Windows Lock)

prasaddn

Active Member
Hi,


I was always wonders if there is any event that excel can catch the event like windows lock and windows unlock.


Basically, when users move out of their desk, they lock their desktop and go and then log in again, I need to track the time of in and out.


Something in excel VBA solutions would be appreciated and not network session objects or audit trails DB, please.


Regards,

Prasad DN.
 
Hi Prasad ,


Probably if you lock the computer using Excel VBA it will be easier ; the following link tells you how :


http://www.ozgrid.com/forum/showthread.php?t=73711


Narayan
 
No, I do not believe you can detect that. You can have a timer check for inactivity within an XL file; which is somewhat useful is you want a file to close after 30 minutes of inactivity or so. Not sure if it fits your needs, but might be a place to start.

http://www.mrexcel.com/archive/VBA/7422a.html
 
Adding on to Luke's suggestion.


You might be able to use a Windows command. Try looking into wmic (Windows Management Instrumentation Command-line) for starters:


example: wmic desktop get screensaveractive


I just started researching this, but I ran out of time (leaving for home). Not sure if it helps, but it might give you something to research.


If that command works, you can do something like this in your timer VBA (you'll need a reference to Windows Script Host Object Model) :


Dim objShell As WshShell

Dim objExecObject As WshExec

Dim strResult as String

Set objShell = New WshShell

Set objExecObject = objShell.Exec("cmd /c wmic desktop get screensaveractive ")

strResult = objExecObject.StdOut.ReadAll


This will put the command line result into the variable "strResult".
 
Thank you for the suggestions.


I afraid I may not be able to use this because I dont want the users to do anything to track and secondly, they may be working on some other application and excel might count these as idle time incorrectly.


The only thing I was looking was to track event of windows lock event and again login event.


No problem. I will look at alternatives other than vba.


Regards,

Prasad DN
 
Back
Top