We will be facing many circumstance where we need to password protect the excel VBA code we have written. Some times it may be for avoiding unintentional changes to the VBA codes or for hiding our codes from the others. Excel VBA provides a simple way to protect Excel VBA macro using password. This will not only protects from making changes also it protects the code from viewing. Lets start learning on how to password protect Excel VBA codes.
Step to protect Excel VBA codes using password
Below are steps to be followed to password protect the VBA codes.
- First open VBA editor. Shortcut key for opening VBA editor is Alt+F11
- Go to tools-> Select “VBA project Properties”
- There new screen pops up. Select “Protection” Tab. You will get a screen similar to given below
- Select the check box beside “Lock project for viewing” to hide the codes from viewing without password. If you do not want to hide the macro code and just want to protect your codes, then do not select the check box.
- Enter the desired password in the “Password” labeled text box. Once again type the same password in the “confirmation password field “too.
- You are done. Save the sheet and close the excel sheet.
- Next time if you open VBA explorer you will prompted for password to view or modify the codes.
This is method of password protecting of Excel VBA codes works on almost all current version of Excel.
Leave a Reply