Password Command Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone please tell me how to set a password to a command button. (I
would prefer not to hear anyones opinion on it.) Can it be done and how???
Any "Help" is greatly appreciated.
 
Here is something simple:

Private Sub cmdDoSomething_Click()
If InputBox("Please enter password", "Enter Password") <> "password" Then
' Wrong password
MsgBox "Sorry, the password you have entered is incorrect." _
& vbNewLine & "Please see an administrator for access " _
& "to this function.", vbExclamation, "Access denied"
Else
MsgBox "Ok, I'll let you in this time.", vbInformation, "Good job"
' Do something here
End If
End Sub

Substitute "password" with your password.
Customize the rest to your needs.
 
Back
Top