Command Button Password

  • Thread starter Thread starter Cindy
  • Start date Start date
C

Cindy

Anyone know how I can add a password to a command button I
put on an Excel 2000 worksheet? My thought was to user
the "inputbox" method but the password typed by the user
is displayed. I then thought I could use
the .passwordchar but it doesn't work.

Thank you

Cindy
 
You can make a userform to show when the command button is clicked. Create
a userform, add a textbox, right click the textbox and put whatever
characters you want in the passwordchar box. Then add two more command
buttons, one to do what ever you want if the correct password is entered,
the other just a cancel button to close the userform if the user doesn't
want to enter the password, although this isn't necessary because the user
can close the form by clicking the 'x' at the top of the form.

HTH
 
Thank you. I was working on that idea before your reply but how do you
open the user form from a command button on the worksheet?



Cindy
 
Cindy,

If the command button is from the Forms toolbar, assign the
following macro to the button.

Sub ShowTheForm()
UserForm1.Show
End Sub

If the command button is from the Controls toolbar, put the
following code in the button's Click event procedure:

UserForm1.Show


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top