PDA

View Full Version : Solved: Prevent viewing/running of Macro



vzachin
03-03-2008, 12:59 PM
Hi,

This is not a VBA question.

is a way to prevent a user from going to
TOOLS --->MACROS--->MACRO to run a macro?

also, i already have this protected via VBAProject Properties but the user can still click on RunMacro.

i have buttons set up for the user to run certain macros. and want to prevent them from running other macros.

is there a way to prevent this?

thanks
zach

Bob Phillips
03-03-2008, 01:59 PM
Add Option Private Module to the VBA modules.

mikerickson
03-03-2008, 08:37 PM
Add an optional argument to some of the Subs.

Sub anyRoutine(Optional UnUsed as Boolean)
UnUsed is never used in any of the routines, so it won't interfere with their operation.
Its an optional argument, so you won't have to hunt down the calling statements; they don't need to be changed.

But the presence of an argument will keep all the Subs off of the Macro dialog box.

(You can call the subs or assign them to controls by typing their name into the text box, rather than selecting from the (now empty) list. But name of the Sub has to be spelt correctly, which should prevent the user from calling them.)

vzachin
03-04-2008, 05:12 AM
xld,
thanks! that was too easy.

mike,
didn't quite understand how to add the optional argument. when i get a moment, i'll try to figure it out.

thanks again for all the help
zach