Password Protect Workbook and worksheet - Allow Five Attemps

Posted on 2007-08-08
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
    LVL 23

    Expert Comment

    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

    ...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

    [ ]

    "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:
    [ ]
    [ ]

    TheScarms AppSentinel Copy Protection Component

    [ ]

    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 ]
    SerialShield SDK may also prove useful:
    [ ]

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




    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
    This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now