If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > excel Pass in stars '*'

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-10-05, 15:26
Alexxx12 Alexxx12 is offline
Registered User
 
Join Date: Sep 2002
Location: NJ
Posts: 139
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\
Reply With Quote
  #2 (permalink)  
Old 01-10-05, 16:06
shades shades is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 01-10-05, 18:32
bhavesh78 bhavesh78 is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 01-10-05, 19:27
shades shades is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On