![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 26
|
I have a project which requires a password to allow specific users to log on. I have tryed using this:
Private Sub CommandButton1_Click() Dim strPass As String strPass = TextBox1.Text Do Until iTries = 3 If strPass = "Secret" Then MsgBox "Log in OK!" Run "LogInOk" End End If MsgBox "Log in NOT OK!" iTries = iTries + 1 Exit Do Loop If iTries = 3 Then Unload Me End Sub However when I press the macro command button nothing happens, I have no Idea what is going on. Any help will be appreciated. Thanks alot Craig |
|
|
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi Craig, This code looks very familiar
Try this Dim strPass As String Dim iTries As Integer Private Sub CommandButton1_Click() strPass = TextBox1.Text Do Until iTries = 3 If strPass = "Secret" Then MsgBox "Log in OK!" Run "LogInOk" End End If MsgBox "Log in NOT OK!" iTries = iTries + 1 Exit Do Loop If iTries = 3 Then Unload Me End Sub The bit I modified was your variable iTries It MUST be at the Module level else it will loose it's value each time. |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 26
|
lol, yeah it does look familiar, thanks for that by the way. I'll see how this works now then, thanks alot Craig |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|