Protect VBA


You can protect you complex VBA scripts from modification and copying through the use of password protection. But yet again the in-built security features offered by Excel can easily be overcome by technically capable users of your spreadsheets. In this post we will demonstrate how to use the standard Excel security to protect you VBA scripts and macros.


Step 1 – Open the VB Script Editor

Open the the Workbook that contains the VBA scripts that are to be protected. From the Tools > VBA Project Properties. Now specify a password for select ‘Lock project for viewing’. Make sure you remember the password and then click OK, finally save the workbook and exit.


Step 2 – Now try and Open the protected VB script

Now re-open the Workbook and access the VB script editor. When you try and open the VB script the password is requested. If you don’t supply it then access to the VB script is denied.


Other Options – VBA Scrambling

If you really need to protect your VB script from easy copying and re-use one of the best methods is to perform some form of scrambling routine so that you VB script essentially becomes unreadable or very hard to follow. That way any user that attempts to simply copy your VB script cannot follow your logic or modify the script for other purposes.

You can scramble you code manually or you can purchase products to perform scrambling of your VB script. One of the best products we have found that can quickly and effectively scramble your VB script has been developed by the Excel developers at XLAutomation. Their product VBA Scrambler offers automated scrambling for VB script. Click Here to find out more about VBA Scrambler.

Before Scrambling

After Scrambling

If you have a question on this post for the Excel Help Desk team or have something you would like to share on this topic then please leave a comment