Results 1 to 6 of 6

Username and Password VBA with the ability for user to change the password

Threaded View

  1. #1
    Registered User
    Join Date
    01-07-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    65

    Username and Password VBA with the ability for user to change the password

    Hey Guys,

    I am just working on a project and it requires that multiple people to login to one workbook with various access.

    I use the code I got from below;

    http://www.mrexcel.com/forum/excel-q...xcel-file.html

    Private Sub Workbook_Open()
    Dim Sh As Worksheet
    Dim UserName As String
    Dim Password As String
    Dim ThisCell As Range
    Dim c As Long
        For Each Sh In ThisWorkbook.Worksheets
            If Sh.Name <> "Welcome" Then
                Sh.Visible = xlSheetVeryHidden
            End If
        Next Sh
        UserName = InputBox("Please enter your user name.")
        Password = InputBox("Please enter password.")
        For Each ThisCell In Sheets("User List").Range("A2:A" & Sheets("User List").Range("A65536").End(xlUp).Row)
            If UCase(ThisCell.Value) = UCase(UserName) And UCase(ThisCell.Offset(, 1).Value) = UCase(Password) Then
                MsgBox "Access Granted"
                For c = 2 To 4
    'This is the number of sheets from C1 to E1
                    If ThisCell.Offset(, c).Value <> "" Then
                        Sheets(Sheets("User List").Cells(1, c + 1).Value).Visible = xlSheetVisible
                    End If
                Next c
                Exit Sub
            End If
        Next ThisCell
        MsgBox "Access Denied"
        ThisWorkbook.Close
    End Sub

    And this works perfectly fine but I need user to be able to amend his/her password after a successful login.

    And if the logging fails I like the code to ask whether user want to close the workbook or want to try entering username and password again.

    Also if user forgets his password it would be great if the code can send an email to user containing the password.

    Finally I like to keep a log for each successful logins... Date, time and user name.Thanks for you help in advance.
    Last edited by zbor; 04-24-2014 at 05:02 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 02-09-2013, 03:06 AM
  2. [SOLVED] Username and Password Form - Show Username in Sheet
    By ryan180 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2013, 07:06 PM
  3. user input of password for username
    By tinkerbelle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-08-2012, 03:03 AM
  4. Display specific user's sheet when username and password is correct
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2012, 04:40 AM
  5. User Password On A Button - Encrypt Password
    By mab in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2010, 08:10 AM

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