Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=Now + TimeValue("00:00:10") _
Procedure:="KeepWindowsActive", Schedule:=False
End Sub
Sub KeepWindowsActive()
runwhen = Now + TimeSerial(0, 0, 5)
'move cursor and click
SetCursorPos 200, 200 'x and y position
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Application.OnTime runwhen, "KeepWindowsActive"
End Sub
Sub StopKeepWindowsActive()
Application.OnTime runwhen, "KeepWindowsActive", , False
Exit Sub