Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding a cancel button


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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" wrote in
message ...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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" wrote in
message ...

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cancel button IamHaxer Excel Programming 3 June 24th 04 05:19 PM
Disable Cancel button R Avery Excel Programming 2 February 9th 04 09:41 PM
Cancel Button Matt Excel Programming 3 February 3rd 04 11:23 PM
Input Box Cancel Button rickylee Excel Programming 2 January 6th 04 11:43 PM
Button To Cancel Macro Bill Lunney Excel Programming 0 July 16th 03 10:27 PM


All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"