Oliver Dewar
Board Regular
- Joined
- Apr 17, 2011
- Messages
- 201
Hi all.
I have a button that runs a macro every 5 seconds.
I have another button to stop the loop.
Problem happens if a user hits the stop button when the sequence is not running - they get an error.
Here's my code for button 1 (start) and 2 (stop):
Is there a way for button 2 - the StopProcessing macro - to run a test like If process is scheduled then run this code - if not then don't?
Cheers all.
I have a button that runs a macro every 5 seconds.
I have another button to stop the loop.
Problem happens if a user hits the stop button when the sequence is not running - they get an error.
Here's my code for button 1 (start) and 2 (stop):
Code:
Sub Process_Emails_and_Backup_Auto()
Application.Run "Process_All_Emails_In_The_Inbox"
runtime1 = Now + TimeValue("00:00:05")
Application.OnTime runtime1, "Process_Emails_and_Backup_Auto"
End Sub
Sub StopProcessing()
Application.OnTime runtime1, "Process_Emails_and_Backup_Auto", , False
End Sub
Is there a way for button 2 - the StopProcessing macro - to run a test like If process is scheduled then run this code - if not then don't?
Cheers all.