top of page

How to hide vba code in excel?

This page will go through your options of hiding your code from others.

hide my vba code

To be frank, if someone really wants access to your code, it is just a matter of time and effort. You cannot really hide it in that sense. I will however go through how to best hide more sensitive code, or data in progressive order.

Use the built in password protect in VBA.​

  • Right click on the module, ​VBAProject Properties, click in protection and choose your password.

  • I am sure there are several ways to crack this, but in my previous experience this was simple with a Hexadecimal decoder, where you basically swap out the password for your own and then open the VBA project with your own newly set password.

Using Excels xlSheetVeryHidden function. ​​

  • Store your more sensitive data in the "veryhidden" worksheet and password protect your VBA code.

  • This is called veryhidden as you can only open the worksheet through VBA.

  • In short --> we are not really increasing the security.

Create an actual .DLL file, COM add-in in short.

  • Use ​VSTO to create a COM add-in, Visual Studio Tools for Office. This is a package inside the Visual Studio program.

  • Yes, you are creating a proper excel plug-in with this, like the ones received by software companies that makes you pay a lot of money for it, which means that no VBA code will be visible inside the excel file as this is not really built on VBA.

  • Visual Studio Tools for Office is not built on VBA, but it is built on something called VB.Net which is very very similar. This means that you quickly can create .COM add-ins with your existing VBA knowledge, and thus "hide" your code in there.

Learn more about VBA here for all my posts:

Learn more about Python here for all my posts:

If you have found this article or website helpful. Please show your support by visiting the shop below.

243 views0 comments


bottom of page