Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2002
    Location
    NJ
    Posts
    139

    Unanswered: excel Pass in stars '*'

    hi,

    excel 2k
    win 2k

    I want a password in '*' in an imputbox. Is that possible and if so then how do I do it?


    [code]
    Dim pass As Variant
    pass = InputBox("What is the pass? ", "Pass for Richard")
    If pass = "123456" Then
    MsgBox "Correct! You can pass."
    Else
    GoTo start_again
    End If
    [/code\

  2. #2
    Join Date
    Oct 2003
    Posts
    1,091
    Can't do it with InputBox. You need a UserForm:

    Put two text boxes in user form (textbox 1 and textbox2).

    Add 2 buttons: one for Log in, another for Cancel

    Set the password textbox PaswordChar property to some characters (i.e. *) which will mask the user's password.

    The Log in name is stored in Sheet1 column A and the password in Column B.
    Hide Sheet1 so that user will not be able to see this.

    Code:
    Private Sub CommandButton1_Click()
    If TextBox1 = "" Then GoTo LogErr
    Set LogName = Sheet1.Range("A1:a65536").Find(TextBox1)
    
    If Not LogName Is Nothing Then
    
        If Sheet1.Range("A1:a65536").Find(TextBox1).Offset(0, 1) = TextBox2 Then
            MsgBox "Welcome " & TextBox1
            'do something
            Me.Hide
            Exit Sub
        End If
    End If
    LogErr:
    MsgBox "Log in error" & Chr(13), vbCritical, "Log in Failed"
    
    End Sub
    
    Private Sub CommandButton2_Click()
    Me.Hide
    End Sub
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

  3. #3
    Join Date
    Dec 2004
    Posts
    78

    Thumbs up

    To set text to * in inputbox see the following link. Works absolutely fine. Just copy paste whole thing at start of ur code and replace inputbox by inputboxDK

    http://www.tek-tips.com/faqs.cfm?fid=4617


    ~BS

  4. #4
    Join Date
    Oct 2003
    Posts
    1,091
    Learn something everyday! Thanks!
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

Posting Permissions

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