Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopping a macro
There are quite a few threads on stopping macros, Ctrl Break, and
EnableCancelKey, but none have helped me. I am a new user of VBA and programming in general, so there may be something very fundamental that Im missing. Is there some underlying setting that can prevent Ctrl Break from working (other than EnableCancelKey = False)? Does a macro have to be executing a command for Ctrl Break to work, or can it be waiting to execute the next command? I have a series of subs, all within Module 1 (Excel 2003). Macro1 sets a schedule for calling the other subs, most of the time this macro is just waiting for the next event. The series of subs is looped through hourly for several days. It does what I want it to do, but I want the user to be able to stop Macro1 from calling further events before the schedule is finished. So far, my only successful way of doing this is to close the file, and re-open with macros disabled. Neither Ctrl Break nor Esc stops the schedule initially read by Macro1. Ive tried the following: Pressing Ctrl Break and Esc in both the VBE and in the worksheet. Two different computers and keyboards. Making the first line of the code read: Application.EnableCancelKey = True (just to make sure this is on, although based on what I have read, this should be the default at the start of a sub.) Adding Application.EnableCancelKey = xlErrorHandler (with On Error GoTo, etc.) Removing all lines of code using EnableEvents = False, DisplayAlerts = False, and ScreenUpdating = False (just in case these could somehow affect the processing of Ctrl Break, although Ive nothing suggesting this). Ctrl Break pressed while a called sub is running (other than during a RefreshAll) causes the Error 18 box to appear, and in VBE, the sub can be reset, but this does not stop Macro1 for continuing the schedule. Any ideas would be greatly appreciated! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stopping a Macro | Excel Programming | |||
Stopping a Macro | Excel Programming | |||
Stopping a Macro | Excel Programming | |||
stopping macro | Excel Programming | |||
My Macro keeps stopping?? | Excel Programming |