Friday, February 27, 2009

Excel VBA: Protecting Excel VBA Macro Code

When we working with Excel VBA macro, sometimes we need to protect our VBA macro code. So nobody can change or modify VBA macro that we have create. Here are steps to protect VBA Project:

  • Go to Visual Basic Editor by pressing Alt+F11 key.
  • In menu toolbar, click Tools -> VBAProject Properties...

  • In VBAProject - Properties dialog box, click Protection tab, and then check Lock project for viewing checkbox.

  • Enter desired password to protect VBA project, then click OK button.
  • Save the VBA project.
FIN.

Related Post:
---
If you like posts in this blog, you can to support me :)

1 comment:

  1. I am writing an application which programmatically creates a userform, then deletes it later. Excel seems to require access to the project in unprotected mode to accomplish this. Commercial software would always be distributed with project protection on. These two requirements seem to be at odds with each other, as there appears to be no reliable and simple way to unlock the project, perform the required functions, then lock it again. Hoping you might have some clues.

    ReplyDelete