Stopping Excel Macro executution when pressing Esc won't work -


i'm running excel 2007 on xp.

is there way stop macro running during execution other pressing escape? if think created infinate loop or otherwise messed hit escape , throws error macro stops.

this time (and i've done before not badly), set msgbox quick debugging. turns out had loop 6000 times, made means had "ok" 6000 message boxes, took several minutes. didn't save before running (another mistake) couldn't open task manager exit.

is there way stop execution of macro in case goof again?

use crtl+break suspend execution @ point. put break mode , can press f5 continue execution or f8 execute code step-by-step in visual debugger.

of course works when there no message box open, if vba code opens message boxes reason become little tricky press keys @ right moment.

you can edit of code while running.

use debug.print print out messages immediate window in vba editor, that's way more convenient msgbox.

use breakpoints or stop keyword automatically halt execution in interesting areas.

you can use debug.assert halt execution conditionally.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -