Here is a possible solution:
Sub MPW()
Dim MyPassword
MyPassword = InputBox("Please enter password", "Password Prompt", "********")
'hardcode password
If MyPassword = "password" Then
MsgBox "Access Granted", vbInformation, "Access"
'call macro
Exit Sub
Else
MsgBox "Access denied", vbCritical, "Error"
Exit Sub
End If
End Sub
Thanks...works great...How do I make it so you only see ******* when the password is entered?
: Is there code that will not allow a Macro to run without a password? I'm using a Button to launch the Macro. : Thanks in advance : Paul
That's a limitation. You could build a form and use
the same logic. : Dim MyPassword : MyPassword = InputBox("Please enter password", "Password Prompt", "********") : If MyPassword = "password" Then : MsgBox "Access Granted", vbInformation, "Access" : 'call macro : Exit Sub : Else : MsgBox "Access denied", vbCritical, "Error" : Exit Sub : End If : End Sub :