VBA Question

J

Justin Starnes

I have a userform that performs a very expensive (time consuming) operation
when the user clicks ok. Is there is any way to allow the cancel button to
be pressed while performing the operation? I believe that this is not
possible with VBA as I believe that Excel is single threaded. Can anyone
confirm this?
 
R

Robin Hammond

There's always the end command but you might need to manage the consequences
if it is half way through something.

You would have to display the form as modeless in xl2000 or higher to be
able to allow the user to interact with the form while the process is
running. A cleaner method might be to display a modeless progress bar and
allow the user to cancel if it is taking too long. There's an example on my
site at http://www.enhanceddatasystems.com/ED/Pages/ExcelProgressBar.htm.

Robin Hammond
www.enhanceddatasystems.com
Check out our XspandXL add-in
 

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

Top