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

Hi
Is there a way how i can stop a macro
maybe by a commandbutton

reagrds
Alvin



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default 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
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
How do I stop a macro from running within a macro? JohnUK Excel Programming 1 June 26th 05 10:59 AM
Stop running a macro in the middle of a macro gmunro Excel Programming 3 June 9th 05 06:00 PM
Macro: With Stop it works. Without Stop it doesn't. Don Wiss Excel Programming 2 October 12th 04 10:49 AM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM
macro won't stop Todd[_5_] Excel Programming 4 October 11th 03 03:42 PM


All times are GMT +1. The time now is 01:14 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"