+ Reply to Thread
Results 1 to 2 of 2

abort macro dialog box

  1. #1
    Chris
    Guest

    abort macro dialog box

    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?

  2. #2
    Nick
    Guest

    Re: abort macro dialog box

    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
    "Chris" <[email protected]> wrote in message
    news:[email protected]...
    > 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?




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1