PDA

View Full Version : Solved: Protection



jmenche
08-06-2007, 05:58 AM
Howdy,

I just realized sumpin'. I always make sure that worksheets are protected and I even protect my VBA project. However, you can run any macro under the Tools menu! Is there any way of protecting against this? This is potentially worrisome since I usually have an UnProtect All sub.

Thanks

Bob Phillips
08-06-2007, 06:09 AM
Put Option Private Module at the start of the module, they won't appear then.

Won't stop them running it, but they won't see them. The protection won't stop them anyway.

rory
08-06-2007, 06:10 AM
First, you can make your functions Private - ie. declare them as Private Sub, not just Sub, or add Option Private Module to the top of each module you want to be private. This will prevent them from appearing in the Macros list, but they can still be run by typing in the name of the macro, so either don't give them obvious names (like UnprotectAll) or add an argument to the routine declaration and always call them from your code passing this argument.
Regards,
Rory

jmenche
08-06-2007, 09:27 AM
Thanks everyone!!!