Search code examples
vbaexceldecompilercopy-protection

how to secure an excel file so that the form and code is secure against copying?


I have an Excel file that has a form and macros. I will give this Excel file to users. However, the form and the code must be protected against copying. I thought to break the Excel macros into DLL so that the VBA code can not be recovered.

Would you know if from the DLL we can recover the original VBA code?

Do you have other ideas to protect against copying?

Thanks


Solution

  • As you might find out soon enough, many people will suggest that you simply don't build applications in Excel that need to be secure, however, I have outlined a few things you can do in order to help protect your code.

    You might consider using a combination of these items in order to best protect the code. Always make a backup of your code before doing these things, or else you risk losing it permanently!

    1. Password Protect the VBA Project (as has been mentioned.)
    2. Add code obfuscation (I've used this link before. You need to test your code after using it though. It basically runs a find-Replace on variables you enter)
    3. Use a protection program such as Unviewable+ (Might be a little pricey, and I admit I've been able to still access code locked with that program)
    4. Use another method to make your VBA project "Unviewable" (I've used This Method and even wrote my own code to implement that method automatically)
    5. Do as you suggest and compile VB code into DLLs which are called from your Excel file (This should "hide" your code from users, but it also requires them to have multiple files in order to use your spreadsheet)
    6. You could additionally password protect the entire workbook. This encrypts the VBA code inside your file. (However, the users to which you give the password can easily remove that password thus storing the code plainly again.) [Edit: This one you would want to combine with item 1 or 3 so that user's can open the file and use it but still cannot access the code]