Vba prevent user to see macro code in Excel

For example, I have a very complex macro based WorkBook that I share with people outside my organization. I would like to prevent outsiders from accessing my macro code.

This is also very useful to protect your VBA code that against copy and to protect your copyrights.

VBA code password protection is a good thing to do when you spent a lot of hours developing some code and that you do not want to be copied or modified

To do it in Excel, here is the answer:

a) In the VBA Editor, right click on "VBAProject (FILE)". Click on "VBAProject Properties".

excel vba prevent user to see macro code

b) "VBAProject - Project Properties" window pops up. Click on "Protection" tab.

excel vba prevent user to see macro code

c) Check "Lock project for viewing". Enter a Password. Confirm Password. Click OK.

excel vba prevent user to see macro code

d) When the file is opened the next time, a "VBAProject Password" dialog pops up. To gain access to the code, right password has to be entered.

excel vba prevent user to see macro code


You can find similar Excel Questions and Answer hereunder

1) How can I hide all comments in my WorkSheet using VBA?

2) How can I make my macro wait for 5 secs before executing the next command?

3) How to add a link in a sheet to another sheet

4) I have to enter non alphanumeric characters in a cell using VBA - how can I get their codes for use in VBA?

5) How can I have text autocomplete by typing in a short code for the text?

6) How can I protect / unprotect WorkSheet using VBA?

7) How do i put double quotes in a string in vba in Excel

8) How to disable ability to insert Rows and Columns in Excel (using VBA)?

9) How can I get row count of filtered data?

10) How can I extract file name from a full path including folder path and file name?


Here the previous and next chapter