View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Kilmer Bob Kilmer is offline
external usenet poster
 
Posts: 280
Default Using code to stop a macro.

If have dominion over the long-running macro code, you can modify it to
check the status of something, like a key press, cell value or an
environment variable, and exit if the status attains a certain value. If the
macros has a form, you can implement a cancel function. But, no you cannot
start one Excel macro that will end another.

"Wrightr" wrote in message
...
In VBA, is there any way you can write a macro that can
stop another macro currently executing. I have a macro
that loops for over 30 minutes. I would like to be able
to write another macro that allows me to neatly stop the
first macro. I can't see anything in VBA that allows you
to do this - especially since it doesn't seem possible to
launch a second macro (using a macro button) when another
macro is still executing.
Is there a work-around?