+ Reply to Thread
Results 1 to 5 of 5

Adding a cancel button

  1. #1
    Amir
    Guest

    Adding a cancel button

    Hi,

    I have a macro which takes a long time to run.

    During the macro operation there is a form showing that the macro is
    currently 'running'.

    Which commands should I put in that form's Cancel button so that it with
    cancel the macro operation?

    I guess I should put some DoEvents lines in my macro code for that to work,
    but I don't know the commands for the cancel button.

    Guess the macro name is MyMacro.


    Kind Regards,
    Amir.



  2. #2
    Registered User
    Join Date
    07-17-2005
    Location
    Bridgwater, Somerset, UK
    Posts
    10
    Ctrl+Break will cancel a running macro, probably the easiest way!!

  3. #3
    Amir
    Guest

    Re: Adding a cancel button

    Hi,

    Thanks for your answer.

    I think that a cancel button is more intuitive. Does anybody know how to do
    that?

    Regards.

    "bigwheel" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Ctrl+Break will cancel a running macro, probably the easiest way!!
    >
    >
    > --
    > bigwheel
    > ------------------------------------------------------------------------
    > bigwheel's Profile:
    > http://www.excelforum.com/member.php...o&userid=25301
    > View this thread: http://www.excelforum.com/showthread...hreadid=397518
    >




  4. #4
    Fred
    Guest

    Re: Adding a cancel button

    You can setup a variable or property that both the form and the macro have
    access to.
    In the Cancel buttons cick event set the variable.
    In your macro you will have to add DoEvents then after the DoEvent check if
    the variable has been set and exit the macro if set.

    Fred

    "Amir" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I have a macro which takes a long time to run.
    >
    > During the macro operation there is a form showing that the macro is
    > currently 'running'.
    >
    > Which commands should I put in that form's Cancel button so that it with
    > cancel the macro operation?
    >
    > I guess I should put some DoEvents lines in my macro code for that to
    > work, but I don't know the commands for the cancel button.
    >
    > Guess the macro name is MyMacro.
    >
    >
    > Kind Regards,
    > Amir.
    >




  5. #5
    Amir
    Guest

    Re: Adding a cancel button

    Thanks,

    Isn't there a way of having a button to do the same thing without having the
    user to know that he needs to use Ctrl+Break?

    "bigwheel" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Ctrl+Break will cancel a running macro, probably the easiest way!!
    >
    >
    > --
    > bigwheel
    > ------------------------------------------------------------------------
    > bigwheel's Profile:
    > http://www.excelforum.com/member.php...o&userid=25301
    > View this thread: http://www.excelforum.com/showthread...hreadid=397518
    >




+ 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