© Ugur Akinci
In certain situations you may want to lock up your MS Excel VBA code so that no one can change your macros by entering the VBE (Visual Basic Editor).
You can do that by locking up your VBE with a password BEFORE distributing or emailing your MS Excel workbook. This would prevent accidental edits and changes as well.
Follow these steps:
(1) When you’re in VBE, select Tools > VBAProject Properties to display the VBAProject – Project Properties dialog box:
(2) Select the Protection TAB:
(3) Select “Lock project for viewing” check box.
(4) Enter a Password and then repeat the same in the Confirm Password field.
(5) Click OK to lock your workbook. From now on only those who know the password will be able to view this MS Excel workbook.
TIP: The password will not take effect until you save and close your workbook.
WARNING: Please do NOT assume that the VBE password cannot be cracked. There is actually some evidence that all you need to do to get around the password is to open the Excel sheet in OpenOffice! Please Google for “how safe is Excel VBE password”. Having said that, here is a good web site that we use to generate random passwords, complete with punctuation marks and all that: http://www.pctools.com/guides/password/