I have a routine, its pretty lengthy and I dont know that its necessary to paste the code to describe the issue. I will if need be...
Anyways, there are basically two procedures that get run here. The the calling procedure gets some info, and creates an object of a custom class. The custom class runs one procedure, it exports all sheets in the workbook to the chosen directory in their own workbook and saved in their own folder. When its done it exits back to the calling procedure, and then the calling procedure ends (Exit Sub).
Everything works. If I step through the code using F8, everything works flawlessly. But, if I let the code run, when it tries to exit back to the calling procedure, excel crashes. Everytime. Without fail.
Now, whats wierd, is that If I let the code run on its own all the way up to "Exit Sub" line of the running procedure in the class module (I put a break line on this line), everything runs fine, and if I hit F8 to execute the "Exit Sub" line, no crash!
I even put message boxes in after each line of code at the end of both procedures, and let the code run on its own, so that I could pinpoint the exact line causing the crash. This confirmed it to be "Exit Sub" in the class module.
WTF? Anyone have any ideas why everything works pefectly if I hit F8 to execute that line of code, but not if I let the program run itself????
I'm very annoyed by this....Any help will be greatly appreciated!
Anyways, there are basically two procedures that get run here. The the calling procedure gets some info, and creates an object of a custom class. The custom class runs one procedure, it exports all sheets in the workbook to the chosen directory in their own workbook and saved in their own folder. When its done it exits back to the calling procedure, and then the calling procedure ends (Exit Sub).
Everything works. If I step through the code using F8, everything works flawlessly. But, if I let the code run, when it tries to exit back to the calling procedure, excel crashes. Everytime. Without fail.
Now, whats wierd, is that If I let the code run on its own all the way up to "Exit Sub" line of the running procedure in the class module (I put a break line on this line), everything runs fine, and if I hit F8 to execute the "Exit Sub" line, no crash!
I even put message boxes in after each line of code at the end of both procedures, and let the code run on its own, so that I could pinpoint the exact line causing the crash. This confirmed it to be "Exit Sub" in the class module.
WTF? Anyone have any ideas why everything works pefectly if I hit F8 to execute that line of code, but not if I let the program run itself????
I'm very annoyed by this....Any help will be greatly appreciated!
Last edited: