I have a WB that opens and if left open for 2 minutes runs the macro below to close it. But if I close the workbook before two minutes it still runs the macro and for some reason reopens it and then closes it.
So I tried to stop the second macro from running [WbCls] by checking to be sure the first is open first, but that does not work either.
Can any one help?
Thanks
Sub TMR()
Sheets("EXCWOS").Select
Application.OnTime Now + TimeValue("00:1:30"), "SaveWb"
End Sub
Sub WbCls()
For Each ws In Sheets
If ws.Name = "EXCWOS" Then
Application.DisplayAlerts = False
Workbooks("ExcludedWo").Close (True)
Application.DisplayAlerts = True
Application.Quit
End If
End Sub
So I tried to stop the second macro from running [WbCls] by checking to be sure the first is open first, but that does not work either.
Can any one help?
Thanks
Sub TMR()
Sheets("EXCWOS").Select
Application.OnTime Now + TimeValue("00:1:30"), "SaveWb"
End Sub
Sub WbCls()
For Each ws In Sheets
If ws.Name = "EXCWOS" Then
Application.DisplayAlerts = False
Workbooks("ExcludedWo").Close (True)
Application.DisplayAlerts = True
Application.Quit
End If
End Sub