With some vba, it's possible.
First, put this into the ThisWorkbook Module to start ther time when the book opens:
Rich (BB code):
Private Sub Workbook_Open()
EndTime = Now + TimeValue("00:15:00")
RunTime
End Sub
It sets a 15-minute timer, adjust that if desired.
Next, put this code into the Sheet module for every sheet you want to reset your "timer":
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
If EndTime Then
Application.OnTime _
EarliestTime:=EndTime, _
Procedure:="CloseWB", _
Schedule:=False
EndTime = Empty
End If
EndTime = Now + TimeValue("00:15:00")
RunTime
End Sub
The part in
red resets a 15-minute timer, so again, change that to the value you want.
Lastly, these macros go in a standard Module and they activate if the timer goes off due to inactivity:
Rich (BB code):
Public EndTime
Sub RunTime()
Application.OnTime _
EarliestTime:=EndTime, _
Procedure:="CloseWB", _
Schedule:=True
End Sub
Sub CloseWB()
Application.DisplayAlerts = False
With ThisWorkbook
.Saved = True
.Close
End With
Application.OnTime EarliestTime:=TimeValue("17:00:00"), _
Procedure:="closeWB", Schedule:=False
End Sub
(
source)
(
more reading)