I have a command button which launches an input box to allow input of a password.
Private Sub CommandButton1_Click()
Dim ThePW As String
ThePW = InputBox("A password is required to run this procedure." & vbCrLf & _
"Please enter the password:", "Password")
If ThePW <> "123" Then MsgBox ("wrong pw")
End Sub
However, when I click exit(X) or cancel, the message box still displays wrong pw
How can I solve this? I don't want it to display wrong pw
when I click exit(X) or select cancel.