+ Reply to Thread
Results 1 to 14 of 14

Adding Password Attempts

  1. #1
    Registered User
    Join Date
    06-07-2011
    Location
    Stockport, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Adding Password Attempts

    Hi. I have a dedicated button on my main data sheet which protects and unprotects it (password protected) when it is unprotected it only allows the user to input in a given range, so other codes are not deleted.

    I am wondering if someone with more knowledge than me (not hard) can help with a little task. The following code works great but I would like the user to have 3 attempts at inputting the password before the workbook closes itself.

    is it possible to display a message after each attempt, say "Wrong password, Please try again" or something?

    Any help will be much appreciated

    Thanks

    code is as follows

    Please Login or Register  to view this content.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,280

    Re: Adding Password Attempts

    Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!

    Read this to understand why we ask you to do this.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    06-07-2011
    Location
    Stockport, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adding Password Attempts

    Sorry. post has been submitted on another forum too. please see below:
    http://www.ozgrid.com/forum/showthread.php?t=155061

    If I get a reply I will update accordingly

    Thanks
    Scott

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding Password Attempts

    How would that work? The password is hard coded, the user doesn't need to input it.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    06-07-2011
    Location
    Stockport, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adding Password Attempts

    The user has to input the password to be able to edit the range.

    Thanks

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding Password Attempts

    Not with that code, maybe they enter it manually

  7. #7
    Registered User
    Join Date
    06-07-2011
    Location
    Stockport, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adding Password Attempts

    Thanks Roy for your reply

    I am new to VBA, been working on it for a week or two now but the code stated seems to work ok? been tested now for a few days.

    I will take anything that you guys say as gospel as I am only a learner. can you help then with my query?

    My Protect Sheet button protects entire worksheet and when pressed, changes name to Unprotect Sheet. once the sheet is unprotected, only range C4:L55 can be modified.

    Can you help with a much user friendly code?

    Thanks
    Scott

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding Password Attempts

    I amended the code for you in the previous post. How you are doing it only unprotects/protects without the user entering the password. You need a different approach to prompt for the password

    Edit: that's not the code that I changed for you

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding Password Attempts

    Try this

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    06-07-2011
    Location
    Stockport, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adding Password Attempts

    Thanks for your reply Roy you have been more than helpful.

    Your help on last post worked great but I was struggling with only allowing users to edit one particular range, so went down another path.

    Sorry for being a pain

    Thanks again

    Scotty

  11. #11
    Registered User
    Join Date
    06-07-2011
    Location
    Stockport, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adding Password Attempts

    Sorry about this Roy, I am getting the same runtime error 438.

    object doesn't support this proprty or method.

    doesn't like the line:
    ActiveSheet.Protection.AlliwEditRanges(1).delete

    Scotty

  12. #12
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Adding Password Attempts

    Just a quick question as Roy doesn't appear to be on line. Did you input it with the i in allow?
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Adding Password Attempts

    That was your line, I only left in because you seemed to want it. It's not necessary, as you were told by Pike in the original thread lock /unlock cells before protecting. Failing that build code to unlock specif ranges

    Try removing the .Delete.

    Also, remember to use Code Tags for all code in posts

  14. #14
    Registered User
    Join Date
    06-07-2011
    Location
    Stockport, England
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Adding Password Attempts

    I know Pike said to unlock the specific cells but what I was after was code to unlock a specific range and keep the rest of the worksheet protected. That's what the original code seemed to do. I came across addeditrange from a help file.

    if the sheet is protected- all cells locked
    if the sheet is Unprotected - only range B4-L55 unlocked, the rest of the worksheet remains locked.

    Thanks again
    Scotty

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1