View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jfeka[_2_] jfeka[_2_] is offline
external usenet poster
 
Posts: 5
Default How to Pause or Stop a running Macro

I have written the following macro which has the effect
of repeating another macro every 20 seconds. You'll note
that it calls the other sub "upDateHis" and this ends
with calling this one ... in effect creating an endless
loop.


Sub rePeater()

Application.OnTime Now + TimeValue
("00:00:20"), "upDateHis"


End Sub

This is fine most of the time, but there are times when I
don't want this loop running and I'm wondering if someone
can suggest a way to either stop or pause this running
macro that I could activate through a control button in
my worksheet. (I know I can stop it by putting in a
break point in the VB code, but I'd prefer something a
bit more elegant)

What ideas do you have?

Jack