Using code to stop a macro.

  • Thread starter Thread starter Wrightr
  • Start date Start date
W

Wrightr

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?
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top