How to Use Compiled Vba in Excel

I wrote some vba code and want to hide it. I know about the password protect stuff, but I found it very unelegant. Instead, opted for code compilation. These are the steps I'm following

1 - open excel

2 - right click on the sheet tab

3 - view source code

4 - write a sub in vb editor

5 - debug / compile vba project

No errors everything's fine

Now, the question is: how do I use the compiled code? Does excel generate something analog to a .jar?

3

1 Answer

From your perspective, the Compile VBA Code command essentially just does a syntax check for you. It's no different than what happens when you run your VBA project -- it first does a syntax check, reporting any errors that it may find, and then "compiles" your code into an intermediary byte code that is then executed. So you can't remove your Module, Class, or Form objects and have it use a "compiled" version of your project.

If you want to hide your VBA code from prying eyes, lock your project with a password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest