Closed Thread
Results 1 to 7 of 7

Thread: User Login

  1. #1
    Registered User
    Join Date
    02-17-2008
    Posts
    32

    User Login

    Hey, had no luck with this after trying various things.

    I have a form where once you open my workbook it asks you to select a user and then enter a password.

    It then checks the password against some data in a sheet using a V lookup.

    The table basically is small and looks like so:

    Administrator - admin
    User1 - password
    user2 - password

    Just 2 columns 3 rows

    The code that deals with the user form is as follows:

    Code:
    Private Sub EnterPassword_Click()
    Dim password As String
    password = PasswordInput.Text
    
    
    If password = WorksheetFunction.VLookup(UserList.Value, Range("Users_List"), 2, 0) Then
    Sheets("Protected").Visible = False
    Sheets("Blank").Visible = False
    MsgBox "Password Accepted"
    Unload Me
    
    
    Else
    
    Sheets("Protected").Visible = xlVeryHidden
    Sheets("Blank").Visible = xlVeryHidden
    MsgBox "Password Not Accepted, Workbook will close"
    Unload Me
    ThisWorkbook.Close
    End If
    
    End Sub
    This part checks the usernames and passwords:

    Code:
    If password = WorksheetFunction.VLookup(UserList.Value, Range("Users_List"), 2, 0) Then
    Sheets("Protected").Visible = False
    Sheets("Blank").Visible = False
    MsgBox "Password Accepted"
    Unload Me
    what I want to do is with the 'Administrator' make it a power user of sorts, and when that user is selected the sheets become visible, like this sort of:

    Code:
    Sub UnhideSheets()
    Dim ws As Worksheet
    For Each ws In Worksheets
    ws.Visible = True
    Next
    End Sub
    But I cant integrate it into the code although I did try:

    Code:
    If UserList.Value = "Administrator" & password = "admin" Then
    UnhideSheets
    End If
    Unload Me
    If anyone knows a way I can do it, I'd greatly appreciate it, this is the last part of my program

    Thanks for looking

  2. #2
    Forum Contributor
    Join Date
    02-19-2005
    Location
    Gurgaon,India
    MS-Off Ver
    2007,2003
    Posts
    167
    Kris

  3. #3
    Forum Moderator dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003 & 2007
    Posts
    3,661

    Smile Re: User Login

    Good afternoon dntel123
    Quote Originally Posted by dntel123 View Post
    I have a form where once you open my workbook it asks you to select a user and then enter a password.

    what I want to do is with the 'Administrator' make it a power user of sorts, and when that user is selected the sheets become visible, like this sort of:
    I have a template available that does just what you are requiring. It can handle an unlimited amount of users (well, just over 65,500 actually) and gives the administrator total control. You just integrate my workbook into yours and away you go - it was designed to be integrated into others peoples' projects and come with full instructions and the code is unprotected so you can see how it works.

    If you would like to use this, PM me your e-mail address.

    HTH

    DominicB
    Now available : Ultimate Add-In 2007
    Integrates directly into the Office Excel Ribbon


    Download Ultimate Add-In v1.52 from www.dom-and-lis.co.uk
    90+ Utilities, 200+ Sub utilities last updated 25th April 2008
    Free!!

  4. #4
    Registered User
    Join Date
    10-11-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    59

    Re: User Login

    Hi DominicB,

    I would like to see a copy of your workbook - would you be willing to post it? Thanks,

  5. #5
    Forum Moderator dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003 & 2007
    Posts
    3,661

    Smile Re: User Login

    Hi Evagrius
    Quote Originally Posted by Evagrius View Post
    Hi DominicB,

    I would like to see a copy of your workbook - would you be willing to post it? Thanks,
    I can't post it, but PM me your e-mail address and i'll forward it on, no problem.

    DominicB
    Now available : Ultimate Add-In 2007
    Integrates directly into the Office Excel Ribbon


    Download Ultimate Add-In v1.52 from www.dom-and-lis.co.uk
    90+ Utilities, 200+ Sub utilities last updated 25th April 2008
    Free!!

  6. #6
    Registered User
    Join Date
    05-12-2009
    Location
    pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: User Login

    Your login form sounds exactly what I've been looking for. Would you be able to email me a copy?

    Thank you

  7. #7
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,443

    Re: User Login

    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

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.2.0