+ Reply to Thread
Results 1 to 15 of 15

Password Prompt

  1. #1
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Password Prompt

    I have an issue with the password prompt. The top of the popup has the actual password to enter which defeats the purpose of security. It happens on the 'Switchboard' worksheet on the 'Protect All Worksheets' and 'Unprotect All Worksheets' buttons. I would appreciate any help solving this problem.
    Attached Files Attached Files

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex
    MS-Off Ver
    365
    Posts
    5,681

    Re: Password Prompt

    Edit row 4 of Module 5 and Module 6. You don't need to put "92bp55" at the end of this line. That is where you stipulate the prompt box header.
    The password is elsewhere in your code.

    BSB
    Last edited by BadlySpelledBuoy; 12-09-2015 at 02:52 PM.

  3. #3
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Password Prompt

    Fantastic thank you. I am learning more each day about Excel thanks to the great support here.

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex
    MS-Off Ver
    365
    Posts
    5,681

    Re: Password Prompt

    Only easy when you know how. We were all where you are at one point, so keep learning

    BSB

  5. #5
    Forum Guru
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,859

    Re: Password Prompt

    Hi billgyrotech,

    You need construction like:
    Please Login or Register  to view this content.
    Try code like the following (tested and working):
    Please Login or Register  to view this content.
    Additional Comments:
    a. It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
    Please Login or Register  to view this content.
    This option requires all variables to be declared and will give a compiler error for undeclared variables.

    b. If you indent the code (it takes a lot of work), it is easier for you and for others to read, and is easier to maintain.

    c. Instead of using 'Module1', 'Module2', etc, if you rename the modules, it may be easier to find the code:
    In Excel VBA, change the name of Module1 or any module to something that means something to you as follows:
    a. Click on any cell in the Excel Spreadsheet.
    b. ALT-F11 to get to VBA.
    c. CTRL-R to get project explorer (if it isn't already showing).
    d. F4 to get the 'Properties' Window.
    e. Left Click on the module you want to rename in the 'Project Explorer'.
    f. In the Properties Window, next to '(Name)', change the name as required.

    d. Debugger Secrets:
    a. Press 'F8' to single step (goes into subroutines and functions).
    b. Press SHIFT 'F8' to single step OVER subroutines and functions.
    c. Press CTRL 'F8' to stop at the line where the cursor is.
    d. 'Left Click' the margin to the left of a line to set (or clear) a BREAKPOINT.
    e. Press CTRL 'G' to open the IMMEDIATE WINDOW. 'debug.print' statements send their
    output to the IMMEDIATE WINDOW.
    f. Select View > Locals to see all variables while debugging.
    g. To automatically set a BREAKPOINT at a certain location put in the line:
    'Debug.Assert False'
    h. To conditionally set a BREAKPOINT at a certain location put in lines similar to:
    if i >= 20 and xTV20 > 99.56 then
    Debug.Assert False
    endif
    i. A variable value will be displayed by putting the cursor over the variable name.

    e. In the future, if your workbook is password protected, you will get more responses if you post the password in the thread. I almost gave up, but found the password in the VBA code.

    I hope all this helps.

    Lewis

  6. #6
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Password Prompt

    Thank you for all the great help. I am in the setting up stages and was wondering if I can have a 'password' cell in the 'Switchboard' worksheet that all macros will reference for the password.

  7. #7
    Forum Guru
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,859

    Re: Password Prompt

    You can have access to the Master Password in many ways, including:
    a. In a spreadsheet cell
    Please Login or Register  to view this content.

    b. In 'BulitIn' or 'Custom' Document Properties:
    To access 'Built In Document Properties':
    Excel 2003: File > Properties > Summary
    Excel 2010: File > Info > Properties > Advanced Properties > Summary


    To access 'Custom Document Properties':
    Excel 2003: File > Properties > Custom
    Excel 2010: File > Info > Properties > Advanced Properties > Custom

    c. As a Global Constant in VBA

    In an ordinary code module such as Module1:
    Please Login or Register  to view this content.
    Lewis

  8. #8
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Password Prompt

    I have most everything functioning well now and hate to mess things up but it would be nice to add this feature.

  9. #9
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Password Prompt

    I can put a master password in 'Switchboard' cell G3. Could you show me how to alter one of the macros and I will try to alter the other ones to allow for a master password please?

  10. #10
    Forum Guru
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,859

    Re: Password Prompt

    Try the following (tested and working):
    Please Login or Register  to view this content.

  11. #11
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Password Prompt

    That seemed to work fine but how can I alter the 'LockRange' and 'UnlockRange' macros? It seems to be too much for me.

  12. #12
    Forum Guru
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,859

    Re: Password Prompt

    Since these routines are VBA only, and do not affect the spreadsheet we can use a slightly different syntax, which allows VBA to access the Sheet, and does not affect the current protection that is set for the Sheet.
    Please Login or Register  to view this content.
    The finished code is:
    Please Login or Register  to view this content.

  13. #13
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Password Prompt

    Okay I replaced the codes. Now clicking on the macros to lock and unlock does not prompt for a password.

    I would prefer it asks for the password entered in 'G3' from the 'Switchboard' for unlocking only.

    I really appreciate the great help.

  14. #14
    Forum Guru
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,859

    Re: Password Prompt

    Hiding Cell G3 in plain sight using Excel 2010:
    a. Right Click cell 'G3' when Sheet is NOT PROTECTED.
    b. Format Cells > Number > Custom
    c. Underneath 'Type:' enter 3 semicolons ';;;'
    d. Left Click 'OK'
    Three semicolons is custom format to hide the contents of the cell.


    The following should prompt for a password to UNLOCK.
    Please Login or Register  to view this content.

  15. #15
    Banned User!
    Join Date
    03-06-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    295

    Re: Password Prompt

    Thank you so very much for truly the fantastic assistance. I do apologize for not following the rules properly. Not sure if you celebrate it but Merry Christmas and Happy New Year!

+ 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. VBA code that bypass Password prompt for every workbook with one master password
    By pwnyadav007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2014, 01:45 AM
  2. Replies: 6
    Last Post: 08-23-2012, 12:12 PM
  3. Prompt for license id and password
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2011, 06:05 AM
  4. Prompt for password in different ranges
    By Yatty in forum Excel General
    Replies: 0
    Last Post: 02-25-2009, 01:18 PM
  5. [SOLVED] vba-password prompt on close
    By kikde in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-15-2005, 09:40 AM
  6. prompt for password only once
    By Mike Boynton via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-27-2005, 09:05 AM
  7. Password Prompt
    By Noel in forum Excel General
    Replies: 0
    Last Post: 05-18-2005, 03:06 PM
  8. Password Prompt
    By LuhElle in forum Excel General
    Replies: 2
    Last Post: 03-08-2005, 08:06 PM

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