Excel freezes when press the close "x" button

New Contributor

I desperately need help. I am developing a large VBA project in Excel (I have some userform, many classes, userdeffined method include in sheet and so on). Unexpectedly, the problem has occurred: when I click on the button to close the Excel window ([x]) my project goes "strange" mode, exactly the cursor shows that Excel is processing something(task manager confirm that), but the menu remains "hard" accessible: i can close and save file. However, the window does not close. In addition, if I close the project before closing the Excel window, the situation exactly repeats. VBA project do not have event handlers like close or same. But I try to check this event and create handler sub with single msgbox: when I close via menu "Close.." that sub run but when I close window sub do not run(. And more thing is this freezing can not be interrupted by Ctrl + Break. I have two suggesting: on one hand problem in objects that remain in memory? but why I don't interrupt it and why menu is accessible on other hand problem in internal Excel

1 Reply
best response confirmed by OHomenuke (New Contributor)

Problem have been found! It was realy simple. In UDF was commands


I think, when I close application run recalculate all function and from function when it set xlAutomaic run new recalculate again and again.