+ Reply to Thread
Results 1 to 10 of 10

Random question / passwords in excel

  1. #1
    Registered User
    Join Date
    04-21-2009
    Location
    Nottingham
    MS-Off Ver
    Excel 2003
    Posts
    66

    Random question / passwords in excel

    Hi All,
    I want to set a question upon opening my spreadsheet which will only open if the correct answer/ password is typed.

    I’d need to store the questions, passwords/ answers somewhere for VB to look up I guess??

    This is a bit above my station.

    So I need help with the actual storing the questions/ answers (For example I will use)

    Capital of England – London
    Capital of France – Paris
    Capital of Italy – Rome

    Etc etc

    And then I need coding which will open one of the random questions, which will only grant access to the spreadsheet if the correct answer is typed.

    Any help much appreciated

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: Random question / passwords in excel

    The method you have described is not very secure - If macros are disabled the workbook can still be opened.

    You can have a set password that has to be entered before the book is opened

    If you insist on using VBA & having the user anser a question then you would probally need to look at code to hide your sheets that would only be made visible if macros were enabled
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    04-21-2009
    Location
    Nottingham
    MS-Off Ver
    Excel 2003
    Posts
    66

    Re: Random question / passwords in excel

    Hi thanks for the comment. By fixing a password before the sheets open – this would have to be one set password am I right?

    Is there any way to vary what the password is (with a set range of course)?

  4. #4
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Random question / passwords in excel

    hi Kevin,

    To add to Mudraker's comments, Excel is not known or touted as a "secure" environment so it is not recommended to rely on the security for highly confidential information etc. Here is a link which outlines the forms of inbuilt Protection provided by Excel: http://spreadsheetpage.com/index.php...otection_faq1/

    The below section may be of the most interest to you...
    http://spreadsheetpage.com/index.php...ction_faq1/#P2

    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  5. #5
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Random question / passwords in excel

    Here's a sample excel workbook that forces users to enable macros.
    You can then have your random question prompt in the workbook_open event.
    I received this code on this forum from one of the gurus and modified it to suit my needs.
    Hope this gets you going in the right direction.
    modytrane.
    Attached Files Attached Files

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Random question / passwords in excel

    modytrane dont know what thats supposed to do but all it does in 97 is open a work book with no visible tabs!
    i can the use alt f11 to edit delete all the code!
    Last edited by martindwilson; 04-22-2009 at 09:37 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Random question / passwords in excel

    martin,
    try it now.
    the vba is password protected. that was the intent when i sent it out with my previous message. i first wanted kevin to work out his other code to enter a list of questons and answers.
    if you don't enable the macros, in excel 2003 it opens one sheet with a message that tells the user that this program doesn't work unless you enable the macros.
    if you enable the macros, it will open one blank worksheet that you can work with.
    modytrane.
    Attached Files Attached Files

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Random question / passwords in excel

    ok thats better
    cant view vba. but only get blank workbook with no tabs, no message to enable.

  9. #9
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Random question / passwords in excel

    martin,
    Here's the same workbook.
    Can't view the VBA.
    When you open with macros enabled, you get the tabs, three worksheets.
    You can add more and create whatever sheets you want.

    In the previous version you could have added worksheets if you wanted to.
    You could also got ot tools\options and make the sheets visible.

    I didn't understand your comment "no message to enable".

    When you tried to open without enabling macros, did you get a message sheet telling you to please close the workbook and re-open with macros enabled?

    modytrane
    Attached Files Attached Files

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Random question / passwords in excel

    thats better cant view vba and now i see message(i forgot my settings enabled macros any way) if i disable macro.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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