+ Reply to Thread
Results 1 to 4 of 4

How to write Macro for Retry Password entry when open Excel

  1. #1
    Forum Contributor
    Join Date
    11-07-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    100

    How to write Macro for Retry Password entry when open Excel

    Dear all expert

    I have an excel document that's password protected to open. If the password is incorrect it asks to verify caps lock is not on in a message box with an OK button. Clicking OK makes the msgbox go away and the user is left with a blank excel window which needs to be closed before re-attempting to open the file and given another try at the password. We often use capslock and it's pretty common to get this message. We then have to go through the close&reopen process, which is a hassle.

    I'm looking for some VBA code that when detect PasswordFail presents the user with a msgbox saying, "The password you entered is incorrect. Check that it's right, make sure capslock is off, and try again" along with another Password field and OK/Cancel buttons.

    Does anyone have a VBA way of doing this or can someone point me in the right direction to finding an answer?

    Thank you soo much for your advise. Any input is welcome.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to write Macro for Retry Password entry when open Excel

    This could almost be considered as trying to get around the password protection. I would think the whole purpose of not giving you a 2nd (or 3rd or 20th) chance is to make it more of a hassle to keep trying to "guess" the password.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    11-07-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: How to write Macro for Retry Password entry when open Excel

    This should not be the way..

    Most of the application allow chance to retry for the password. So is there any macro allow user to retry the password?

    Thank you.

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: How to write Macro for Retry Password entry when open Excel

    Good morning EvelynLoh

    A macro cannot run until the file is opened. The file will not open unit the password is input correctly. A macro is not the way forward with this.

    Why not remove the password, and have the file located in a folder with Windows pemissions set up so that the only certain users can access the file?

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 06-07-2016, 01:27 PM
  2. [SOLVED] Excel macro that can open up a website and input a user name and password.
    By glide2131 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-09-2014, 09:10 PM
  3. [SOLVED] Need macro to open excel sheet that is password protected
    By sokker23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2013, 03:04 PM
  4. Help on duplicate password entry loop to retry
    By jhamer-arthrex in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2013, 01:20 PM
  5. Write a password into a macro
    By djfatboyfats in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-23-2007, 05:46 PM
  6. how can use C# write data into excel with password?
    By hanlei in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-28-2005, 11:05 AM
  7. [SOLVED] How do I write an Excel macro to open a file using the CommonDial.
    By Lynn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2005, 10:06 AM

Tags for this Thread

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