abort macro dialog box

C

Chris

Hi there,

I have a little problem making an dialog box.
In my excel sheet i have a commandbutton who runs through my macro.
Since i don't want other people to abort the macro with Esc or
Ctrl-Break i have put this line in: Application.EnableCancelKey =
xlDisabled

But now people don't have the ability at all to stop the macro. For
some people i think this is anoying because the macro runs for about 2
á 3 minutes.

So what i want is 1 abort key, and when they hit this key there is a
dialog box whith a warning and a 'cancel' and a 'run macro further'
button, somthing like that.

Can someone give me some advice or point me in the right direction?
 
N

Nick

The simplest way is to set the enablecancelkey property to xlErrorHandler
and trap the canel key press in an error handler.
You can then prompt them to cancel or continue.
If they press cancel then exit the procedure.
If they press run further then put the resume statement in the error
handler.

Hope this helps
Nick
 

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