Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Guys, a rather simple thing, yet i don't know why it does not work:
the code asks simply for a password, if the password is correct, perform the code. Or if the user typed nothing in the inputbox, or pressed Cancel, do nothing. If the password is wrong, give message "wrong password". response = InputBox("give password: ") = "abcdefg" If response = vbNullString Then Exit Sub 'This code should exit the sub if no typing or pressed on Cancel button If response = "abcdefg" Then 'Code to execute Else MsgBox "password incorrect!", vbCritical End If this doesn't work as it should, any ideas what's wrong? Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Memento" skrev i en meddelelse ... Hello Guys, a rather simple thing, yet i don't know why it does not work: the code asks simply for a password, if the password is correct, perform the code. Or if the user typed nothing in the inputbox, or pressed Cancel, do nothing. If the password is wrong, give message "wrong password". response = InputBox("give password: ") = "abcdefg" If response = vbNullString Then Exit Sub 'This code should exit the sub if no typing or pressed on Cancel button If response = "abcdefg" Then 'Code to execute Else MsgBox "password incorrect!", vbCritical End If this doesn't work as it should, any ideas what's wrong? Thanks in advance. Try this: response = InputBox("give password: ") = "abcdefg" If response = False Then Exit Sub 'This code should exit the sub if no typing or pressed on Cancel button If response = "abcdefg" Then 'Code to execute Else MsgBox "password incorrect!", vbCritical End If Regards, Per |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Memento -
response = InputBox("give password: ") '= "abcdefg" 'Following code should exit the sub if no typing Cancel If response = vbNullString Then Exit Sub If response = "abcdefg" Then 'Code to execute MsgBox "Password Correct !", vbInformation Else MsgBox "password incorrect!", vbCritical End If --- Jay "Memento" wrote: Hello Guys, a rather simple thing, yet i don't know why it does not work: the code asks simply for a password, if the password is correct, perform the code. Or if the user typed nothing in the inputbox, or pressed Cancel, do nothing. If the password is wrong, give message "wrong password". response = InputBox("give password: ") = "abcdefg" If response = vbNullString Then Exit Sub 'This code should exit the sub if no typing or pressed on Cancel button If response = "abcdefg" Then 'Code to execute Else MsgBox "password incorrect!", vbCritical End If this doesn't work as it should, any ideas what's wrong? Thanks in advance. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe this:--
Sub getpass() response = InputBox("give password: ") If response = "" Then Exit Sub If response = "abcdefg" Then MsgBox "correct password entered" Else MsgBox "password incorrect!", vbCritical End If End Sub Mike "Memento" wrote: Hello Guys, a rather simple thing, yet i don't know why it does not work: the code asks simply for a password, if the password is correct, perform the code. Or if the user typed nothing in the inputbox, or pressed Cancel, do nothing. If the password is wrong, give message "wrong password". response = InputBox("give password: ") = "abcdefg" If response = vbNullString Then Exit Sub 'This code should exit the sub if no typing or pressed on Cancel button If response = "abcdefg" Then 'Code to execute Else MsgBox "password incorrect!", vbCritical End If this doesn't work as it should, any ideas what's wrong? Thanks in advance. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can use strptr funtion ...........
response = InputBox("Enter password") If StrPtr(pq) < 0 Then 'Code to execute Else MsgBox "password incorrect!", vbCritical End If Exit Sub :) have a great time Gaurav Kothari "Memento" wrote: Hello Guys, a rather simple thing, yet i don't know why it does not work: the code asks simply for a password, if the password is correct, perform the code. Or if the user typed nothing in the inputbox, or pressed Cancel, do nothing. If the password is wrong, give message "wrong password". response = InputBox("give password: ") = "abcdefg" If response = vbNullString Then Exit Sub 'This code should exit the sub if no typing or pressed on Cancel button If response = "abcdefg" Then 'Code to execute Else MsgBox "password incorrect!", vbCritical End If this doesn't work as it should, any ideas what's wrong? Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Test for Cancel in Inputbox | Excel Programming | |||
How do I capture CANCEL on an Inputbox? | Excel Programming | |||
How do I capture CANCEL on an Inputbox? | Excel Programming | |||
Help with inputbox (Distinguish OK from Cancel) | Excel Programming | |||
Clicking Cancel on an Inputbox | Excel Programming |