Abort Loop Process

jaydwest

JayW
Local time
Today, 08:35
Joined
Apr 22, 2003
Messages
340
I often use loops in code. Sometimes if things get hung up, I would like to be able to abort the Loop while its in the middle of processing. Often the loop is processing so fast that it will not stop with a {ctrl}{break} and requires a {ctrl}{alt}{delete]. Obviously this is usually ugly and is bad enough for me, but I cringe at suggesting it to clients. Usually it is the last resort.

So I added a test in a loop to test for a global variable

If gbStopCurrentProcess = true then Stop

This seems to give the loop enough time to catch the {ctrl}{break}. At least in my current sub. However it is not very pretty. The code interrupted dialog is displayed.

Is there any way to abort a loop and display a message box, run a function, or open another form.

Thanks for your help. And yes I did try to find the answer to this issue using Search. :cool:
 

Users who are viewing this thread

Back
Top Bottom