Here is one way to do it.
It is a routine I helped someone on this board with...
Dim Lasttime As Double
Dim Thistime As Double
Sub Auto_Open()
Application.OnEntry = "zerotime"
Lasttime = Now
Thistime = Now
CounterTime
End Sub
Sub Auto_Close()
Application.StatusBar = False
Application.OnEntry = ""
Application.OnTime Now() + TimeSerial(0, 0, 1), procedure:="countertime", schedule:=False
End Sub
Sub CounterTime()
Thistime = Now - Lasttime
Application.StatusBar = "Unused for " + Format(Thistime, "hh.mm.ss") + ". Closes in 00.05.00"
If Thistime > TimeSerial(0, 5, 0) Then
ThisWorkbook.Save
Auto_Close
ThisWorkbook.Close
End
End If
Application.OnTime Now() + TimeSerial(0, 0, 1), "countertime"
End Sub
Sub Zerotime()
Lasttime = Now()
End Sub
HTH
Ivan
Re: Save and exit Excell after a certain amount of inactivity.
Thanks a lot Ivan! How about closing the spreadsheet after a certain time of inactivity?
Thanks again!!
David