R
Roger on Excel
[Excel 2003]
I have a spreadsheet which uses forms to enter and display data. The
Spreadsheet uses a main page form "frmDashboard" from which other userforms
are activated using command buttons. The form frmDashoboard remains open in
the background as a desktop while the user activates the other forms.
I am looking at various methods to password protect the opening of other
forms from the main useform frmDashboard and I use the following code to do
this:
Private Sub CommandButton1_Click()
Dim i_pwd As String
i_pwd = InputBox("Please Enter Password" & vbCrLf & "to activate form")
If i_pwd = "password" Then
UserForm2.Show
Exit Sub
Else
MsgBox "Incorrect password; no action taken.", vbInformation
End If
End Sub
This works well enough however my problem is that the password has to be
entered everytime the command button is pressed (when userform2 is closed).
Is there a way to alter the code so that it remembers that the password has
been entered once? That way it wont keep asking for it.
I would need the algorithm to reset each time the spreadsheet opens, but I
guess it would be okay as long as it remembers it as long as frmDashboard is
open.
Can anyone help?
I have a spreadsheet which uses forms to enter and display data. The
Spreadsheet uses a main page form "frmDashboard" from which other userforms
are activated using command buttons. The form frmDashoboard remains open in
the background as a desktop while the user activates the other forms.
I am looking at various methods to password protect the opening of other
forms from the main useform frmDashboard and I use the following code to do
this:
Private Sub CommandButton1_Click()
Dim i_pwd As String
i_pwd = InputBox("Please Enter Password" & vbCrLf & "to activate form")
If i_pwd = "password" Then
UserForm2.Show
Exit Sub
Else
MsgBox "Incorrect password; no action taken.", vbInformation
End If
End Sub
This works well enough however my problem is that the password has to be
entered everytime the command button is pressed (when userform2 is closed).
Is there a way to alter the code so that it remembers that the password has
been entered once? That way it wont keep asking for it.
I would need the algorithm to reset each time the spreadsheet opens, but I
guess it would be okay as long as it remembers it as long as frmDashboard is
open.
Can anyone help?