View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jay Dean Jay Dean is offline
external usenet poster
 
Posts: 154
Default PASSWORD PROMPTING CODE

Thank you very much. It worked beautifully !!

Jay Dean

"TroyW" wrote in message ...
Jay,

This code uses a simple InputBox to query the user for a password.

Troy


Sub RequestPassword()

Dim sReply As String

sReply = Application.InputBox( _
Prompt:="Please enter the password", _
Title:="Password Required", _
Type:=2)

If sReply = "thePassword" Then
'''Run the password protected code.
MsgBox sReply & " is the correct password"

Else
'''Do not run the password protected code.
MsgBox "Sorry, incorrect password"
End If

End Sub



"Jay Dean" wrote in message
om...
I have assigned a macro code to a command button in Excel. I need a
macro code to add to my original code that will prompt any user that
pushes the button to enter a password before the code assigned to the
button executes.
Any assistance will be appreciated.Thanks!

Jay Dean.