JumboCactuar
Well-known Member
- Joined
- Nov 16, 2016
- Messages
- 788
- Office Version
- 365
- Platform
- Windows
Hi,
as an example below
when executed from button, displays the message then 1 minute later executes it again.
Now if the button is pressed more than once, it is looping more than once. So if i press it then press it 30 seconds later im getting a message box every 30 seconds. I want any existing macros on timer to stop
How can i cancel the application.ontime for any macros in workbook first?
Also same for when closing workbook
Thankyou
as an example below
Code:
Sub ontimer()
MsgBox ("Hello")
Application.OnTime Now + TimeValue("00:01:00"), "ontimer"
End Sub
when executed from button, displays the message then 1 minute later executes it again.
Now if the button is pressed more than once, it is looping more than once. So if i press it then press it 30 seconds later im getting a message box every 30 seconds. I want any existing macros on timer to stop
How can i cancel the application.ontime for any macros in workbook first?
Also same for when closing workbook
Thankyou