Home » excel » excel – Password protected VBA but code still visible

excel – Password protected VBA but code still visible

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have an excel macro file(.xlsm), when I open the VBA editor, on the left panel I right click on VBA project XYZ and click on VBAProject properties, it prompts for a password. This indicates that VBA is password protected. However, I am still able to see the macro codes in modules/sheets.

  1. Is that possible and if yes then what’s the point here in protection?

  2. Though I am able to see the code, when I try to add a reference, I again get that password prompt. Why?

How to&Answers:

That is because you or the author haven’t clicked on Locked project from viewing while protecting the VBA Project.

enter image description here

Also you need to close and re-open the workbook for the Lock Effect to take place after Locked project from viewing is checked

Your Questions

Is that possible and if yes then what’s the point here in protection?

Yes it is possible. The intention here could be to ensure that you don’t make any changes to say references as you have already experienced. OR someone simply forgot to click on Locked project from viewing like shown above.

Though I am able to see the code, when I try to add a reference, I again get that password prompt. Why?

As mentioned above, since the VBA Project is locked, you cannot make changes like adding a reference.