Password Protect Workbook and worksheet - Allow Five Attemps

Posted on 2007-08-08
Medium Priority
Last Modified: 2013-11-05
Hi Developers need a vba code to password protect a workbook and work sheet in the work book. 5 attemps at the code before locking out.

Same password for workbook and worksheets.......

Question by:keilah
  • 2
LVL 23

Expert Comment

ID: 19652740
Hi keilah,

It sounds like you are trying to do some advanced protection, and the fact is that no protection is going to stand up more than 2 minutes to anyone who really wants to get in the file - excel protection just isn't that robust and there are too many tools out there to crack excel passwords.

The normal code for excel protection is:

Sheets("mySheet").Protect "myPassword"

Workbook("myWorkbook").SaveAs Workbook("myWorkbook").FullName, , "myPassword"

These don't however include the functionality to lock someone out after 5 tries, and I don't believe that there is going to be a simple way to implement this in Excel.

LVL 35

Accepted Solution

[ fanpages ] earned 2000 total points
ID: 19653084
...and if the user disables VBA support (i.e. hits the [Disable Macros] button) then the whole methodology is bypassed anyway.

You may like to investigate two other options I have received found whilst replying to another question:

Secure software protection system

License:       Free to try, $99(US) to buy

[ http://www.perfectdownloads.com/software-development/management-distribution/code-lock.htm ]

"Are you losing sales to software pirates? Stop using your weak software protections now. Code-Lock is an advance secure software protection system that will protect your Visual Basic applications by stopping crackers in their tracks. It is very easy to install and only ONE line of code is required to protect your software. Code-Lock featuring CodeSecure Technology, has never been cracked to date. It is time to keep crackers awake while you sleep. A lot of sharewares are cracked by crackers mainly because they uses weak protection schemes. Most rely on registration codes that can be cracked by experienced crackers. Other protection schemes might include time checks or keyfiles. But the sharewares are in effect registered versions and once the cracker patches certain places, the sharewares will behave like registered versions. The better form of protection involves only distributing demos that has limited functions. Registered users are sent the registered version or are told of the URL to download the registered version. Such methods are more secure but it is still possible for crackers to use fake credit cards to register and get the registered version and distribute it. Legitimate users might just register a copy of it, download it and then share with friends. Code-Lock prevents the creation of the registered version of your program unless the correct registration serial is used. The registration serial will not be valid on another computer. The registered version will only run on the registered user's computer. There is no need to download a registered version by the registered user. Furthermore, the registered version is watermarked and can be traced to the registered user. Attempts to remove the watermark will render your program useless. To date, programs protected by Code-Lock have not been cracked or warezed by unethical crackers!!"

Author's site:
[ http://www.rtsoftware.org ]
[ http://www.chosenbytes.com ]

TheScarms AppSentinel Copy Protection Component

[ http://www.thescarms.com/appsentinel/default.aspx ]

TheScarms(tm) AppSentinel lets you quickly and easily create evaluation versions of your software and stop unauthorized copying and unregistered use of your programs!

Create Safe and Secure Trial, Demo, Evaluation or Rental Versions of Your Software

    *      Evaluation versions will have trialware functionality like the number of days or number of runs1 left and checking to see if the system clock was turned back!

    *      Evaluation versions of your applications can be turned into the full, non-expiring version by entering a Registration ID. This functionality can be added to your Windows software whether it is an .EXE, .DLL, COM component, Excel application...

    *      AppSentinel simplifies application rental! Your application can expire at regular intervals. Users will have to re-register with you to renew their subscription and use your application for another period.

Copy Protect Your Software and Prevent Sharing of Your Software

    *      Reliably prevent the unlicensed use of your application! Users will not be able to copy and run your program on another computer.

    *      If your application is copied to another PC it will expire when its trial period ends. The user must contact you and officially register the application on that computer.

    *      Attempts to use registration information from a licensed copy of your application in another copy of your program will fail! The special Registration ID required to unlock your application is generated from an Evaluation ID and Machine ID. Because these values are unique to a specific computer, Registration IDs cannot be copied!

What is AppSentinel?

    *      AppSentinel is a COM component2 (ActiveX DLL) that can easily be incorporated into your application regardless of the programming language used.

    *      AppSentinel is an insurance policy for your programs. AppSentinel provides software copy protection to eliminate illegal and unauthorized use of your programs. AppSentinel protects your software by forcing unregistered copies to expire and stop running.

    *      AppSentinel is an add in that let's you easily create evaluation or rental versions of your applications. AppSentinel contains all necessary date logic and functionality.

Why Use AppSentinel?

    *      So you don't lose sales of your applications to software pirates! You worked hard developing your software and don't want people to use it without paying for it! AppSentinel copy protects your programs so only registered versions will run on registered computers. Applications using AppSentinel that are copied but not registered will stop running after a specified trial period.

    *      Use AppSentinel to let people try your program before they buy it. Adding AppSentinel to your application adds all the typical trialware features. Users can evaluate your software for a limited time before it expires. They can then unlock it once they register it.

    *      Using AppSentinel let's you focus on developing your application! No need to write your own trialware or rental logic or worry about protecting your software. AppSentinel contains all the logic necessary to create evaluation and rental versions of your applications and to stop unlicensed use of your programs.


LVL 35

Expert Comment

by:[ fanpages ]
ID: 19653437
SerialShield SDK may also prove useful:
[ http://www.ionworx.com/serialshield.html ]

Please let me/us know what option you go for.




Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question