Most Valuable Professional


View Jan Karel Pieterse's profile on LinkedIn subscribe to rss feed
Subscribe in a reader

Subscribe to our mailing list

* indicates required

File crashes Excel!!

Save my workbook!
The best tool for salvaging problematic workbooks.

Trainings

Excel VBA Masterclass (English)
Excel VBA for Financials (Dutch)

Third party tools

Speed up your file

FastExcel
The best tool to optimise your Excel model!

Repair your file

Stellar Phoenix Excel Repair
Best tool to repair corrupt Excel sheets and objects
Home > English site > Articles > Create Addins > Protect code
Deze pagina in het Nederlands

Creating an addin from an Excel macro.

Protecting Your Code

Generally spoken there are two important reasons why VBA code would be protected:

The Visual Basic Editor offers the option to lock a project for viewing. From within the VBE, choose Tools, VBAProject Properties. Select the second tab and check the "Lock Project for Viewing" checkbox:

The protection tab of the VBAProject properties dialog.

After that, optionally enter a password.

Unfortunately, the level of protection this offers is bad. One can download small programs from internet that remove the password in the blink of an eye and with a simple HEX editor, one can do the same manually by simply replacing three or four characters inside the file.

The only really secure way to protect the code is by NOT using VBA, but rather by building the application in e.g. VB6 or by creating a com addin using Office developer edition.