View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] Incid3ntal@googlemail.com is offline
external usenet poster
 
Posts: 2
Default Password Protecting a command button

hi A

you could try using a inputbox something like below should give you an
idea of what to do

Option Explicit
Dim mypassword As String

Private Sub CommandButton1_Click()
mypassword = Application.InputBox("Please Enter Password",
"Restricted")
If mypassword = "test" Then 'set your password here
MsgBox ("run your code here") ' add your own code to delete sheets
here
Else
mypassword = Application.InputBox("Incorrect Password try again",
"Restricted") 'try again
End If
End Sub

hope this is of some use for you

S