Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Button To Cancel Macro
To release some CPU time insert a DoEvents statement into the mainloop of
your code. Pressing ESC while a macro is running will stop the code. If you have Excel 2000 or above you can show a 'modeless' form. Versions of Excel prior to this only allow you to display a form which will not relenquish control to the worksheet until the form dissapears. Use something like frmTest.Show True to display the form in modeless mode. This way you can put a Cancel button or something similar on the form, show it, execute your code as normal. Insert the relevent code into the click event of the cancel button and then this allows the user to cancel an operation. Look at this page for a detailed explanation. http://www.billlunney.com/Excel/FAQ/...?ExcelFAQID=51 -- Regards, Bill Lunney www.billlunney.com "Alex Wolff" wrote in message ... Hello, I have seen a couple of posts on this already but still not sure how to do it. When my macro starts I want to display a button that gives the user the opportunity to "Cancel". Also while the macro is running it seems to suck up all the CPU time. How do I keep my macro from sucking all CPU? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to get userform Cancel button to invoke Exit Sub in calling macro? | New Users to Excel | |||
Workbook_BeforeClose(Cancel As Boolean) - Cancel won't work | Setting up and Configuration of Excel | |||
Macro screen- everything but Run and cancel is greyed out | Excel Discussion (Misc queries) | |||
message box without ok or cancel button | Excel Discussion (Misc queries) | |||
Cancel a Link and a Macro | Excel Discussion (Misc queries) |