<> operator : Comparison Operators « Language Basics « VBA / Excel / Access / Word






<> operator

 
Sub AskForPassword2()
       Dim pWord As String

       pWord = ""
       Do While pWord <> "PASS"
           pWord = InputBox("What is the Report password?")
           If pWord = "" Then Exit Do
       Loop
       If pWord <> "" Then
           MsgBox "You entered correct password."
   End If
End Sub

 








Related examples in the same category

1.Comparison operators in VBA
2.If/Then/Else with Comparison operators
3.Select Case with Comparison operators