Results 1 to 4 of 4

Capture System Idle Time

Threaded View

  1. #1
    Registered User
    Join Date
    09-22-2014
    Location
    India
    MS-Off Ver
    2003
    Posts
    7

    Unhappy Capture System Idle Time

    Hi,

    I have been working on a form to be supplied to my production floor to capture production but also wanted to have a feature where I know how much time a guy spends away from system (Non Productive).

    I found a code which gets me very close to what I want but with a headache. I am unable to figure out how to get the data on a specific sheet so I can sum it up..

    Need you to help me get this output on a sheet instead..


    Paste the below code in a module, Open the immediate window and run printidletime1. Every 5 seconds you would see immediate window popping up the idle time.


    Private Type LASTINPUTINFO
      cbSize As Long
      dwTime As Long
    End Type
    Private Declare Sub GetLastInputInfo Lib "user32" (ByRef plii As LASTINPUTINFO)
    Private Declare Function GetTickCount Lib "kernel32" () As Long
    Function IdleTime() As Single
      Dim a As LASTINPUTINFO
      a.cbSize = LenB(a)
      GetLastInputInfo a
      IdleTime = (GetTickCount - a.dwTime) / 1000
    End Function
    Sub PrintIdleTime1()
      Debug.Print IdleTime
        Application.OnTime Now + TimeSerial(0, 0, 5), "PrintIdleTime2"
    End Sub
    Sub PrintIdleTime2()
    Debug.Print IdleTime
      Application.OnTime Now + TimeSerial(0, 0, 5), "PrintIdleTime1"
    End Sub
    Last edited by VJOSHI; 09-24-2014 at 11:11 AM. Reason: Admin Suggestion

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Capture time when system is locked & unlocked
    By kt090678 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-15-2015, 05:20 AM
  2. Macro or function to capture the system date
    By vijanand1279 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2014, 01:25 AM
  3. Capture System Time On button click
    By sap_iias in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-02-2014, 10:45 AM
  4. Macro to track system's idle time
    By clickrudra in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-02-2013, 01:50 AM
  5. Idle time
    By frequent391 in forum Excel General
    Replies: 1
    Last Post: 07-24-2011, 03:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1