I have checked this code but no success, I have a timer code which I want to link with system idle time so that every thie system is idle for 5 or more minute it will start counting the time and once user activity is noted it will pause...
the code is like...
Dim StopTimer As Boolean
Dim Etime As Single
Dim Etime0 As Single
Dim LastEtime As Single
Dim tcount As Single
Private Sub ExitBtn_Change()
If ExitBtn.Value = True Then
StopTimer = True
Sheets("sheet1").Range("b2").Value = ElapsedTime.Text
tcount = 0
Unload Me
End If
End Sub
Private Sub ResetBtn_Change()
If ResetBtn.Value = True Then
StopTimer = True
Etime = 0
Etime0 = 0
LastEtime = 0
tcount = 0
ElapsedTime.Text = "00:00:00"
End If
End Sub
Private Sub StartBtn_Change()
If StartBtn.Value = True Then
StopBtn.Value = False
StopTimer = False
Sheets("sheet1").Range("b2").Value = tcount
Etime = tcount
Etime0 = Timer() - LastEtime
Etime0 = Sheets("sheet1").Range("b2").Value
Do Until StopTimer
Etime = Int((Timer() - Etime0) * 100) / 100
If Etime > LastEtime Then
LastEtime = Etime
ElapsedTime.Text = Format(Etime / 86400, "hh:mm:ss") '& Format(Etime * 100 Mod 100, "00")
DoEvents
End If
Loop
End If
End Sub
Private Sub StopBtn_Change()
If StopBtn.Value = True Then
StartBtn.Value = False
Sheets("sheet1").Range("b2").Value = ElapsedTime.Text
tcount = Sheets("sheet1").Range("b2").Value
StopTimer = True
'Beep
'TextBox1.Value = ElapsedTime.Text
End If
End Sub
where I just want to start and stop timer , can you please help me with this..