Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
stop a macro
Hi
Is there a way how i can stop a macro maybe by a commandbutton reagrds Alvin |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
stop a macro
Hi Alvin,
Search this newsgroup for: xlerrorhandler and you'll find your answer -- Regards, Sébastien <http://www.ondemandanalysis.com "alvin Kuiper" wrote: Hi Is there a way how i can stop a macro maybe by a commandbutton reagrds Alvin |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
stop a macro
There are many ways to stop a macro.
on a PC Ctrl-Break Ctrl-C power button (ok some are more drastic than others. ;) In case you are asking how to allow a user to stop a macro by pressing the Control key. (warning, this code was reduced to a "minimal" state and may not actually since variables may not be declared, orphaned lines might still exist, etc. Public Const VK_CONTROL = &H11 Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer Sub LoopingRoutine() Dim intResponse As Integer On Error GoTo ErrorRoutine Do Until 0 = 1 If GetAsyncKeyState(VK_CONTROL) Then intResponse = MsgBox(Prompt:="Did you wish to stop looping?", Buttons:=vbYesNo) If intResponse = vbYes Then Exit Do End If End If Loop ExitRoutine: Exit Sub ErrorRoutine: Resume ExitRoutine End Sub -- My handle should tell you enough about me. I am not an MVP, expert, guru, etc. but I do like to help. "alvin Kuiper" wrote in message ... Hi Is there a way how i can stop a macro maybe by a commandbutton reagrds Alvin |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
stop a macro
Thanks
Alvin "AnExpertNovice" wrote: There are many ways to stop a macro. on a PC Ctrl-Break Ctrl-C power button (ok some are more drastic than others. ;) In case you are asking how to allow a user to stop a macro by pressing the Control key. (warning, this code was reduced to a "minimal" state and may not actually since variables may not be declared, orphaned lines might still exist, etc. Public Const VK_CONTROL = &H11 Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer Sub LoopingRoutine() Dim intResponse As Integer On Error GoTo ErrorRoutine Do Until 0 = 1 If GetAsyncKeyState(VK_CONTROL) Then intResponse = MsgBox(Prompt:="Did you wish to stop looping?", Buttons:=vbYesNo) If intResponse = vbYes Then Exit Do End If End If Loop ExitRoutine: Exit Sub ErrorRoutine: Resume ExitRoutine End Sub -- My handle should tell you enough about me. I am not an MVP, expert, guru, etc. but I do like to help. "alvin Kuiper" wrote in message ... Hi Is there a way how i can stop a macro maybe by a commandbutton reagrds Alvin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I stop a macro from running within a macro? | Excel Programming | |||
Stop running a macro in the middle of a macro | Excel Programming | |||
Macro: With Stop it works. Without Stop it doesn't. | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming | |||
macro won't stop | Excel Programming |