Hi all,
I am using this code in a workbook to activate a timer when it is opened, then after 15 minutes make it close and save changes. my question is, if I have this workbook open, then open another the timer seems to activate on that one too, then as a iswitch between it starts the timer again.
I have no issue with timer restarting, but how can I stop the macro from starting the timer on any other work book?
TIA
I am using this code in a workbook to activate a timer when it is opened, then after 15 minutes make it close and save changes. my question is, if I have this workbook open, then open another the timer seems to activate on that one too, then as a iswitch between it starts the timer again.
I have no issue with timer restarting, but how can I stop the macro from starting the timer on any other work book?
Code:
Private Sub Workbook_Activate()
On Error Resume Next
Application.OnTime dTime + TimeValue("00:15:00"), "CloseMe", , False
On Error GoTo 0
End Sub
Private Sub Workbook_Deactivate()
dTime = Time
Application.OnTime dTime + TimeValue("00:15:00"), "CloseMe"
End Sub
TIA