TheAntiGates
01-11-2012, 01:10 PM
I have a long slow loop and I'd like to set some particular code in motion if a particular keystroke was pressed.
Keypress or Keydown look like they're for forms only in VBA - correct me if I'm wrong. I can set up application.onkey okay, but it doesn't appear to be respected (while code is "running"). I inserted a doevents in the loop but still no go. By the way, I used Control-1 ("^1") which should be acceptable even though it is preassigned to open the options/format dialog.
The only two ways I've interrupted code loops is by escape key (works some times but not all times; I'm curious why) and by control-break. I'm seeking something a little more robust, so I can have the code clean up objects and reset Application.Calculation, EnableEvents, etc.
XL03 on Win XP (of course! XL07 is the worst redesign in scientific history!!)
Keypress or Keydown look like they're for forms only in VBA - correct me if I'm wrong. I can set up application.onkey okay, but it doesn't appear to be respected (while code is "running"). I inserted a doevents in the loop but still no go. By the way, I used Control-1 ("^1") which should be acceptable even though it is preassigned to open the options/format dialog.
The only two ways I've interrupted code loops is by escape key (works some times but not all times; I'm curious why) and by control-break. I'm seeking something a little more robust, so I can have the code clean up objects and reset Application.Calculation, EnableEvents, etc.
XL03 on Win XP (of course! XL07 is the worst redesign in scientific history!!)