Programatically stop macro

John Yazou

New Member
Joined
Mar 17, 2002
Messages
49
Hi guys..
Say I have a macro XX running... & I have a useform with a Stop Macro command button. How, if its possible, to stop XX using the cmdbutton_click() event handler??
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Would something like this do the trick?


Private Sub CancelButton1_Click()
Userform1.Hide
End
End Sub

Rgds
AJ
 
Upvote 0
End can be dangerous.
To stop a seperate process, use a Global flag. Place a line in such as this...
If ExitNow Then Exit Sub
Assign the boolean ExitNow as True with your commandbutton.
Tom
 
Upvote 0
Gotcha... thanks... so basically I will modify XX to check the global variable upon entry, exit or mid-way or something right??
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,174
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top