How to Protect or lock our VBA code

Hello Readers,

Welcome to Coding by Learning !!! 😀 

VBA has the feature of locking the code using password.

Since MS-Office applications come with VBA coding editor by default, It is always a good practice to lock the code before deploying it.

It will help the code from getting deleted/modified by users



Go to the coding editor using Alt + F11.

Navigate Tools -> VBA Project properties




Select the protection tab in the dialog box












Check the checkbox “Lock the project for viewing”

Type password and confirm password and click ok.










Save and close the file.

Now your code is protected !!!

To check this, open the file again and go to VBA editor. You can see the project code is locked now










Enter the Password to view the code.














We learnt to protect VBA code now 😀

Happy learning & Happy coding!!!

Comment and share this post to your friends and colleagues 😀

Comments

Post a Comment

Popular posts from this blog

VBA Interview Questions - Part 2 - Variables and Data types

VBA Interview questions - screen updating

VBA Interview questions - Part 3 - Array concept