Thread: Password Form
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] james.billy@gmail.com is offline
external usenet poster
 
Posts: 69
Default Password Form

On 28 Nov, 21:40, Karen53 wrote:
Hi,

I'm not sure I can do this. I've been unable to figure out how, but I have
created a password form. I need to use this form to unlock specific cells
and run code depending on the password being correct. I am successful if
there is only one routine the password form is unlocking. I need a value of
true or false to be pulled into multiple routines. I'm thinking a function
but I can't figure out how to achieve it. I'm hung up on where do I go with
cmdOK?

Function GoodPassword(GoodPswd) As Boolean

Dim HasPswd As String

frmPassword.Show

HasPswd = frmPassword.txtGetPswd

Unload frmPassword

GoodPswd = False

If HasPswd = "" Then
GoodPswd = False
Else
If HasPswd = MyPassword Then
GoodPswd = True
End If
End If

End Function

--
Thanks for your help.
Karen53


Hi Karen,

Could you not have a sub routine that shows your form, then when a
user enters the password and clicks ok use the on click event of the
command button to test the password, if its correct then close the
form and run all the other code, if its not then close the form and do
nothing? If you need to run multiple routines then run multiple sub
routines when the user clicks ok. You could then just put Option
Private Module at the top of your normal sub procedures so that the
user cant see them and therefore cant run them without first entering
the password.

James