Consulting

Results 1 to 5 of 5

Thread: Multi-use UForm - can it be improved upon?

  1. #1

    Multi-use UForm - can it be improved upon?

    Hi,

    I am writing some VBA which will require the user to confirm their credentials in different places depending on what they are doing.

    I don't really want to make a different Username/Password UForm for each one (because there would be different actions once the user has authenticated their credentials).

    I have made something that works (see attached. Note: the target VBA was recorded). But this seems odd to me and not very elegant...

    Can anyone help me make this better?

    Thanks

    Aman
    Attached Files Attached Files

  2. #2
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    6,988
    Location
    Add a new sheet. Three columns: App_UserName; UserName (For their Password User Name); And PW. If their UserName is the same as their Windows Login Name (App_UserName) You won't need the App_UserName column.
    List the names and Passwords.
    In the VBA Editor, use the Properties to set that sheet's Visible Property to xlVeryHidden

    In the ThisWorkbook Code page
    Dim GoodPw As Boolean
    In VBA, Application.UserName returns the windows login name

    In the Password UserForm, set GoodPW = True. Anywhere else just use
    If Not GoodPW Then
       MsgBox "you need to use a Password"
       Exit Sub
    End If
    I always 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 Tutor
    Joined
    Dec 2008
    Posts
    298
    Location
    Quote Originally Posted by SamT View Post
    In VBA, Application.UserName returns the windows login name
    SamT, what's the matter with you?


    pr1asd
    , i
    t is not a good practice to store passwords in an explicit form in a workbook.
    In the attached example, passwords are stored as a hash function (MD5).
    I devastated your project a little.


    Artik
    Attached Files Attached Files

  4. #4
    Knowledge Base Approver VBAX Guru
    Joined
    Apr 2012
    Posts
    4,642
    If you need the macrorecorder for this, you'd better shy away from any (fake) protection in Excel.

  5. #5
    Moderator VBAX Wizard SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    6,988
    Location
    Aetik, that belongs on Stack Overflow, not VBA Express.
    I always expect the student to do their homework and find all the errrors I leeve in.

    Please take the time to read the Forum FAQ

Posting Permissions

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