Phelony
05-05-2009, 07:27 AM
Hi Guys :hi:
I'm trying to write a short piece of code to basically shut down excel if the user has been inactive for 5 minutes or longer.
The code I've got is adapted from something previously used in Access, however, I don't seem to be able to get it to work properly.
In short, if you haven't done anything to this workbook in 5 minutes it closes itself down. It doesn't need to save, it doesn't need to warn you, it just needs to boot you out. :hi:
Can anyone shed some light on where I've gone wrong?
Private Sub Form_Timer()
Const IDLEMINUTES = 0.01
Static ExpiredTime
Dim ActiveFormName As String
Dim ActiveControlName As String
Dim ExpiredMinutes
ExpiredMinutes = (ExpiredTime / 1000) / 60
If ExpiredMinutes >= IDLEMINUTES Then
ExpiredTime = 0
IdleTimeDetected
End If
End Sub
Sub IdleTimeDetected()
If TimerInterval = 30000 Then
Application.Quit
End If
End Sub
Thanks
Phel x
I'm trying to write a short piece of code to basically shut down excel if the user has been inactive for 5 minutes or longer.
The code I've got is adapted from something previously used in Access, however, I don't seem to be able to get it to work properly.
In short, if you haven't done anything to this workbook in 5 minutes it closes itself down. It doesn't need to save, it doesn't need to warn you, it just needs to boot you out. :hi:
Can anyone shed some light on where I've gone wrong?
Private Sub Form_Timer()
Const IDLEMINUTES = 0.01
Static ExpiredTime
Dim ActiveFormName As String
Dim ActiveControlName As String
Dim ExpiredMinutes
ExpiredMinutes = (ExpiredTime / 1000) / 60
If ExpiredMinutes >= IDLEMINUTES Then
ExpiredTime = 0
IdleTimeDetected
End If
End Sub
Sub IdleTimeDetected()
If TimerInterval = 30000 Then
Application.Quit
End If
End Sub
Thanks
Phel x