View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Paul B Paul B is offline
external usenet poster
 
Posts: 709
Default permissions for running macros

Charlene, here is one way,

Sub PassWord_To_Run()
'must lock VBA project so you can't see the password in it

Dim MyStr1 As String, MyStr2 As String
With ActiveSheet
MyStr2 = ("123") 'This is the password and it is CASE sensitive
MyStr1 = InputBox("Password Is Required To Run this Macro ")
If MyStr1 = MyStr2 Then

'your code here

Else
MsgBox ("Access Denied")
End If
End With
End Sub
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"Charlene" wrote in message
...
Thank-you but I am not too worried about people being able to view the
properties of a macro, I am worried about people running the macro.

The steps per your instructions disable anybody from viewing the
properties
of a macro which is great but the option to run the macro is still there
and
when I tried to run it I was able to run it without having to enter that
password that I used for protecting the properties of it. Is there a way
so
that when you click on run that it asks for a password before running it?

"Jens Palacios Neffke" wrote:

1.- Go to the visual basic editor.
2.- To the left theres a list in Bold "VBA Project (name of your
workbook),
right click it
3.- Choose VBA Projet properties
4.- Click the Protection Option
5.- Enable "Lock Project from Viewing" and put some password on it

Thats it, next time you enter you wont be able to view your macros
without
the password


"Charlene" wrote:

I'm very new to macros and am using Excel 2003. I have written a macro
to
protect only certain worksheets within my workbook, however I do not
want
everybody being able to run this macro. How do I put security on this
macro
so only certain individuals have the ability to execute it?