Quote:
I have an excel with macros when users tries to access the code behind the excel by clicking ALT + F11 then the excel should close it self.
This is a bad solution to another problem. User can have legitimate reasons to go to developer mode.
If you want to protect you macros from user eyes, just use the standard protection with a password.
If the user opens the macro editor before your macro is loaded, and you are done.
A developer can also build a macro that open the macro editor without using ALT + F11, and you are done.
To protect macros, from the macro editor, use Tool menu and protect the project with a password.