PDA

View Full Version : [SOLVED:] Kill Process When Break Mode is Reset



CiViCChiC79
07-31-2014, 07:08 AM
Is there a way to kill other running processes when break mode is reset? Let's say I'm testing some code that opens an excel object and processes hundreds of records. Access throws an error and I step through the code to find the problem. Now that the problem has been found (and fixed), I want to start the process from the top again. If I exit break mode with the reset button, my excel file is still running in the back ground and I have to kill it manually. Is there a way to automatically kill such a process if the sub gets terminated? I am not making changes to the Excel file, so no need to save it or anything. On Error GoTo... is not an option because then I lose the ability to step through the code at the problem point and check variable values, etc. Thank you for any help!!

Casee :cool:

jonh
07-31-2014, 09:08 AM
Not that I know of. If it's still in scope you could issue the close command on the object via the immediate window before you stop the code, or right click and use set next statement to jump to your tidy up code if that's an option.

CiViCChiC79
07-31-2014, 11:57 AM
Not that I know of. If it's still in scope you could issue the close command on the object via the immediate window before you stop the code, or right click and use set next statement to jump to your tidy up code if that's an option.


Thanks Jon! Those are two great ideas that I will definitely put to use!

Casee