Consulting

Results 1 to 5 of 5

Thread: Creating a Login page on Excel

  1. #1
    VBAX Regular
    Joined
    May 2017
    Location
    Dunedin, Otago
    Posts
    11
    Location

    Creating a Login page on Excel

    Hello, I am trying to create a login page for my excel document to make sure only the correct people can access this.
    Does anyone know a code for this?
    Sorry, I just got started with VBA, so...

    Thanks!

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Password Protect the Wordbook. That is a little bit more secure than writing all the passwords in plain text inside a "Log In" macro.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Regular
    Joined
    May 2017
    Location
    Dunedin, Otago
    Posts
    11
    Location
    Thanks- but actually I'm not to worried about security.
    It just has to look good for my teacher, so...

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Try this

    1. Add a blank or decorated WS ("Opening")

    2. Add a pretty userform ("Logon") with a pictures, labels, etc. and two TextBoxs (tbUserName and tbPassword) and a command button (cbLogon)

    3. In the ThisWorkbook module, BeforeClose event make "Opening" visible = true and all other worksheets visible=veryhidden

    4. In the ThisWorkbook module, Open event make "Opening" visible = true and all other worksheets visible=veryhidden, and then load and show Logon

    5. Add code to cbLogon to check tbUserName against tbPassword and count the number of attempts

    6a. If they 'match', close the UF, show all the worksheets, and hide "Opening"

    6b. If the don't match after 3 tries, then close the WB without saving



    As Samt says, there is no real security by doing this, but if 'form' is more important than 'substance' it should be OK

    PW protect the project also anyways


    Post an example if you want feedback
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  5. #5
    VBAX Regular
    Joined
    May 2017
    Location
    Dunedin, Otago
    Posts
    11
    Location
    That's good, thanks!

Posting Permissions

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