It seems like that at least one of the built in security features in Microsoft Defender for Endpoints interfere with debugging, and close down the debugged application as a security measure. First ...
Enhance your projects with a standalone VBA development framework that provides debugging, source control, and Test Driven Development tools with 100% VBA.