+ Reply to Thread
Results 1 to 7 of 7

How to set a macro to input a password and not let the user know what the password is?

  1. #1
    Forum Contributor
    Join Date
    12-03-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    107

    How to set a macro to input a password and not let the user know what the password is?

    Hi all, here is my problem that i made into an example form:

    I have a restaurant that has two excel files, one is the ORDER SHEET and one is the RESTAURANT DATABASE files. The order sheet gets filled up by the employees in the restaurant and that file calls up data from the RESTAURANT DATABASE files by using VLOOKUP. But the RESTAURANT DATABASE file is password protected and the employees dont know the password. The problem here is that when the employees fill up the order sheet the file will ask the password of RESTAURANT DATABASE. Is there a macro around this that when they're in the order sheet and there's a password prompt there will be a macro to override the password. So basically im asking for a way to make them able to input a password whenever they are prompt in the order sheet but not be able to know what the password is, is this possible?






    Here is an example to help:
    excel forum restaurant order sheet.xlsx
    restaurant database.xlsx

    The password for the database is abc123
    I apologize since the VLOOKUPS on the order sheet will not work since the links are localized in my computer, If there was anyway i can make it downloadable and the vlookups accessible without editing it i would but i dont know how.

    So in the order sheet, the employee types either HTDG, TCO, HMBRG, FRNCHF in the item code column and the columns beside it are the ones that are vlookup-ed to the database. But if you do that without opening the database file it would prompt for a password, so here is where i'd like a macro that can override the password so they can use the order sheet freely, but still be blocked from the database file. I hope someone can help in any way, thanks.

  2. #2
    Forum Contributor
    Join Date
    12-03-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: How to set a macro to input a password and not let the user know what the password is?

    bump, anyone? :\

  3. #3
    Forum Contributor
    Join Date
    02-24-2011
    Location
    Belfast, N. Ireland
    MS-Off Ver
    Excel 2010
    Posts
    103

    Re: How to set a macro to input a password and not let the user know what the password is?

    Kjy1989,

    Just thinking at the moment but you could give each employee a standard, low level, password which if they enter and get right runs a macro to unlock the database, carries out some operation, then locks the database again with the same password. the problem may be having the database file open while they are working, it would be unprotected at that point in time.

    Mowgli

  4. #4
    Forum Contributor
    Join Date
    12-03-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: How to set a macro to input a password and not let the user know what the password is?

    That's really my dilemma, how to make the database file open enough for them to use, but not for them to copy or edit. Too bad i dont know how to do SQL or MsAccess so i have to do with excel. After weeks of searching i may think this is just wishful thinking.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: How to set a macro to input a password and not let the user know what the password is?

    Hello kjy1989,

    Using formulas to create a database is like the little pig that built his house from straw. While formulas are easy and familiar, they can not guard against the potential problems that databases encounter. It is more work to do it using VBA but provides you with a robust environment that will protect your database. Now your house is not only brick, it is reenforced with rebar.

    This macro reads the database from a custom text file into a public collection named "Ingredients" and the file is then closed. The ingredient list is returned as a comma separate string when a recognized Order Code is used. This safeguards the database in several ways. The database file is read only using the macro preventing the user from changing anything. The database file is closed after being read which prevents accidental corruption of the data should Excel crash. Closing the file after reading also allows multiple users to have access to the database with no need for passwords.

    ThisWorkbook Module Macro
    Please Login or Register  to view this content.
    The custom text file is named Restaurant.dbt. Currently, the macro looks for the this file in the same folder as the workbook. The first line identifies the file as the database file. The order code must be followed by a pipe character and then the ingrediants list which is separated by commas.

    To edit this file use NotePad. When you select this file, Windows will ask you how you want to open the file. Select "Choose program" and select NotePad. You can make additional entries and save them. Just be sure to follow the format as outlined.

    The macro will alert you to errors in the file and provide you with the line number in the file where the error was found. You will be asked if want to continue running the macro after an error has occurred.
    Custom Database Text File
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Forum Contributor
    Join Date
    12-03-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: How to set a macro to input a password and not let the user know what the password is?

    Leith Ross, thank you very very much for your comprehensive post. I am digesting what you posted as i'm writing this reply and i will let you know if i have any problems/questions. Thank you and i appreciate the effort.

  7. #7
    Forum Contributor
    Join Date
    12-03-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: How to set a macro to input a password and not let the user know what the password is?

    Hi Leith Ross, I opened your file as is, did not move the files anywhere in the computer and just opened it in the zip file. When i type a code in column B it returns an error saying Run time error '53' : File not found. I am trying my best to understand your very complex (for my standards at least) macro and cannot pinpoint the problem. What am i doing wrong?

+ 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