If I'm running a Do... Until or a For... Next loop in a button click event, is there a way I can allow the user to click the same button while the loop is running and escape the loop?
OldQBasicer
0
Light Poster
Recommended Answers
Jump to PostYou can use
Exit While
,Exit For
,Exit Sub
, etc.
Jump to PostUse a Variable like bLoopCancel to control your loop.
Initially set it false.
Code your loop so that if bLoopCancel is true, your loop terminates
When a loop is executing (Do, for ..) it may not respond to the user.
Use
Application.DoEvents()
inside the loop now …
All 6 Replies
sknake
1,622
Senior Poster
Featured Poster
selvaganapathy
31
Posting Pro
sknake
1,622
Senior Poster
Featured Poster
OldQBasicer
0
Light Poster
sknake
1,622
Senior Poster
Featured Poster
Progr4mmer
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.