View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Protect macro for unauthorised use

One way is to ask for the password right in the macro.

Sub PassExample()
Dim PW As String
PW = InputBox("Password please", "Password to Run Macro")
If PW = "pass" Then
MsgBox "Running macro"
Else
MsgBox "Sorry"
End If
End Sub


--
Jim
"Johan_vl2431" wrote in message
...
| How can I protect a macro so that you need to give a password before you
can
| run the macro?
| Once the file is closed the macro protection should automatically be
| protected.
|
| Thank you in advance!
|