Protect macros?

A

agentcooter

How can I keep a user from accessing macros in a spreadsheet. I have
some of the macros run when needed via VBA, and I have other macros
that I use for such things as protecting or unprotecting all or
selected sheets as needed. But I don't want the other users to be
able to manually access the macros.
Thanks for any help.
 
J

JulieD

Hi

you can password protect the vba project (ie the macros), press ALT & F11 to
switch to the VBE editor,
find your workbook's name in the Project Explorer (view / project explorer)
right mouse click on it
choose VBAProject Properties
Go to the protection tab
tick the check box and put a password in.
 
J

Jason Morin

Just be aware that Excel's protection is not invincible. There are commercial
password breakers as well as free methods (ie hex editor) available to break
VBA project passwords. A persistent individual with access to the internet
could view your code if they really wanted to.

HTH
Jason
Atlanta, GA
 
A

agentcooter

Thanks Julie. I had done that, but the user can still run a macro by
selecting Tools/Macro, selecting a macro, and clicking Run.

Also, I realize that worksheet and workbook protection are easily
bypassed. I just need to keep the user from stupidly running a macro
that can screw up the book.
 
A

agentcooter

Thanks Jason. I myself have some tools here to break the passwords,
and if I can do it, anyone can. I just need to keep the user from
running a macro that may screw up the book.
 
D

Dave Peterson

If you add:
Option Private Module
to the top of each general module, then the names won't be visible in the
Tools|macro|macros... dialog.
 
A

agentcooter

Thanks Dave. That's what I was looking for. I've tinkered with Excel
for a few years, but I just keep on learning new stuff all the times.
Thanks to all who replied.
 
S

SharonP.

Dave, I'm working with this hint and am having a problem/question.
When I add this Option Private Module as a Declaration - is is not visible
in the Tool/Macro/Macros but I also can't run the macro either. What am I
missing. I don't want the macro viewable for the general public but I need
to run it still.
 
S

SharonP.

Thank you for the info. I'm surprised that worked especially since the
shortcut didn't.
 
J

Just Learning

Just wanted you all to know that I used the instructions below and it works
great! Just what I was looking for!

Thanks loads!
 
Top