• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Password Protection of Workbook and Wooksheet

cyliyu

Member
I have an Excel sheet and would like to protect both the workbook and worksheet.
I can write VBA code and save it as .xlsm file.
Is there a way to prevent the password kept in the VBA to prevent other to know the password if the workbook was hacked?
 
In the VB Editor, you can password protect it .. although it's only secure enough for folks who don't want to poke around in your code.

You could make one sheet VERY HIDDEN and put the password/s there - also making that specific sheet password protected.

Now .. to get to the center of your question ... place a string in the REGISTRY or hide a text file somewhere on the computer with the password. When the user enters the correct password, the VBA code will check this REGISTRY entry or read the text file with the password .. if they match the book opens.
 
Thanks Logit for your reply.
You mentioned to make one sheet VERY HIDDEN and put the password there, isn't user will be able to see the sheet if he/she can go into the VBA editor?
 
Thanks Logit for your reply.
You mentioned to make one sheet VERY HIDDEN and put the password there, isn't user will be able to see the sheet if he/she can go into the VBA editor?

You can also password protect the VBA editor. However, if someone really wants to get into your code, there are plenty of ways to do so. The built-in password protection provided by Excel for the VBA editor only keeps out the honest folks.

Another level to protecting the VBA Editor is to make it totally unviewable - which makes it even harder for the average individual to break into it. There are code samples on the Net showing how to make the Editor unviewable.

From my research, the only way you can truly keep folks from seeing your code is to make the workbook an excecutable - a stand alone program just like any other piece of software.

Making it an executable will keep just about everyone out of it except for those who know how to use a HEX Editor (like hackers).
 
Back
Top