Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping Macro from code 1

Status
Not open for further replies.

camidon

Programmer
May 9, 2000
268
US
I've got a macro that pretty much runs all day long. All it really does is press <Enter> for me every 5 seconds to refresh my screen and then checks some other screens every now and then. The problem is that sometimes I need to stop this macro so that I can perform some functions.

Is there a way to stop a macro from another macro?

Thanks,

Chris
 
Not that I'm aware of.

One thing you could do, although it's a bit ugly, is to use a file. Maybe have your macro check for a file on the desktop called "stop macro.txt". If it finds the file then exit the loop, otherwise keep going.

Then when you want to stop the file you could just create a new text file on your desktop with that name. This method is not a lot prettier than other methods.

1. ctrl-alt-del method of stopping the ebrun task.
2. If you've run it from Extra! you can do tools>macro stop playback (exact method depends on Extra! version)

I'd also make sure you have at least 1 "DoEvents" in the code to ensure that the program stops cleaner. It will also help in your computer performance as the macro will allow other processes to be completed instead of hogging resources.

calculus
 
What about something like this in your code, assumiung that the program is in an endless loop


StopMacro = MyScreen.WaitForKeys(5000, "S")
If StopMacro = "S" then Stop

Now you should be able to just press the S key to stop the Macro from running any longer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top