If you want that if user is inactive for certain period say 5 secs than excel file to close automatically then yes it is possible:
Use below code:
In WorkBook module:
In Worksheet Module:
Cheers!!
Click Download Example with Timer in it:
Use below code:
In WorkBook module:
Private Sub Workbook_Open()
EndTime = Now + TimeValue("00:00:05") ' Change time limit
RunTime
End Sub
In Worksheet Module:
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:00:05") ' Change time limit
RunTime
End Sub
In Standard Module: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 End Sub
Cheers!!
Click Download Example with Timer in it: