Blanked Password enter

M

mushy_peas

I have the following

Sub Admin()
Dim Pass

Pass = InputBox("Please Enter Password to Log in as Admin")

If Pass = "1234" Then
Application.Run Macro:="showme"
Application.Run Macro:="Sheets_Show"
' Application.Run Macro:="Unprotect"
Else
MsgBox "Sorry Wrong Password"
Worksheets("Till").Select
Range("B10").Select
End If
End Sub

i know im prob pushing it a little, but is there a way to blank put
what i type so others cant see the password.

Thanks you
 
T

Trevor Shuttleworth

Not with an InputBox. You'll need to define a UserForm with a Text Field.
You can then define the PasswordChar to be an "*" or whatever.

Regards

Trevor
 
S

ste mac

Hi Mushy...

I have a workbook that was a download from Ozgrid, written by a guy
called Dave Hawley... it does exactly what you want...
You can change the password, username and the form to whatever
you want... if you want it I will send it over..

seeya ste
 
S

ste mac

Hi Mushy...

I have a workbook that was a download from Ozgrid, written by a guy
called Dave Hawley... it does exactly what you want...
You can change the password, username and the form to whatever
you want... if you want it I will send it over..

seeya ste
 
M

mushy_peas

Actually i figured it out. Just used a user form. If any1 wants to know,
email me(above) or reply here.

Thanks Trev & Ste
 
M

mushy_peas

NO!!!!!!!

Got 1 small prob and a "would be nice"

1. small prob is that if no password is put in, then i get an error

2. i use a macro to start the useform, but can i get the cursor to go
to the textbox, and when i hit the ENTER key, it presses the OK
button.

this would be the icing on the cake, but this is so cool!
 
T

Tom Ogilvy

having an empty textbox, in and of itself does not raise an error - so the
error must be in your code. You need to check for this condition and react
accordingly.

Set the tabindex property of the textbox to 0

for the OK button, set the "default" property to True
 
M

mushy_peas

hey Tom
i have this
Dim Password As String
With EnterPass
.TextBox1.Text = ""
.Show
If .Tag = vbOK Then
Password = .TextBox1.Text
Else
Worksheets("Till").Select
Range("B10").Select
End If


Im im not sure what goes after the Else to close the the box, which i
what i think is casung the error
 
T

Tom Ogilvy

Dim Password As String
With EnterPass
TextBox1.Text = ""
.Show
End With
If EnterPass.Tag = vbOK Then
Password = EnterPass.TextBox1.Text
Else
Worksheets("Till").Select
Range("B10").Select
End If
unload EnterPass

You should have code to hide EnterPass in the code module of the userform.

Private Sub OK_Click()
me.hide
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top