Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Password Form

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Password Form

Is the password like a master password--the user enters it once and then they
can access all the routines (well, if they entered it correctly)?

If yes, I'd create a public variable in a General module:

Option Explicit
Public PassWordIsOk as Boolean
Sub firstroutinehere()

passwordisok = goodpassword("mypasswordhere")

'then before you do anything important

if passwordisok = false then
msgbox "Nope!"
else
'do the work
end if
End Sub

Sub SecondRoutineHere()

if passwordisok = false then
msgbox "Nope!"
else
'do the work
end if

End Sub


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


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Password Form

Hi,

Thank you both for your help. I don't seem to be able to get my head around
this. I finally solved the issue by using a form label and assigning a value
to it when I called the password form. I then used the label value as my
"Traffic Cop" to route back to the appropriate routine.
--
Thanks for your help.
Karen53


"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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password "Form" Craig Coope Excel Discussion (Misc queries) 2 May 17th 07 10:24 PM
PASSWORD REMOVAL I have the password to open the file and the password to modify the file now how to remove them LJ[_4_] Excel Programming 0 April 27th 06 03:18 AM
Password protection for an individual form Mort_Komabt[_2_] Excel Programming 2 December 20th 05 09:30 PM
Creating a password form Andrew Excel Programming 1 April 5th 05 01:43 AM
username and password for form excel vba macro finalfantasy_2u Excel Programming 0 January 9th 04 06:07 AM


All times are GMT +1. The time now is 01:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"