davesexcel.com

Excel information

Most Popular Excel Questions

Enter Password

Posted by davesexcel on November 11, 2012 at 5:45 AM

If you want the user to enter a password before completing an action use a User Form.

How to make a userform click the link.

http://www.davesexcel.com/createauserform.htm

Create your userform and draw a textbox and two buttons on it.

Select the textbox and then in the properties window under PasswordChar enter * (astrix)



Use this code in the UserForm


Private Sub CommandButton1_Click()

'ok button

    If TextBox1 = "123456" Then

        MsgBox "you have the correct password"

    Else

        MsgBox "wrong password"

    End If

    Unload Me

End Sub

Private Sub CommandButton2_Click()

'cancel button

    Unload Me

End Sub

Private Sub UserForm_Initialize()

Me.Caption = "Enter Password"

End Sub


 

 


You finish Password Userform




Categories: None

Post a Comment

Oops!

Oops, you forgot something.

Oops!

The words you entered did not match the given text. Please try again.

You must be a member to comment on this page. Sign In or Register

0 Comments