Consulting

Results 1 to 4 of 4

Thread: Solved: Prevent viewing/running of Macro

  1. #1
    VBAX Tutor
    Joined
    Feb 2006
    Posts
    295
    Location

    Solved: Prevent viewing/running of Macro

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Add Option Private Module to the VBA modules.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Add an optional argument to some of the Subs.

    [VBA]Sub anyRoutine(Optional UnUsed as Boolean)[/VBA]
    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.)
    Last edited by mikerickson; 03-03-2008 at 08:47 PM.

  4. #4
    VBAX Tutor
    Joined
    Feb 2006
    Posts
    295
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •