Consulting

Results 1 to 4 of 4

Thread: Solved: Protection

  1. #1

    Solved: Protection

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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.
    ____________________________________________
    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
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    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

  4. #4
    Thanks everyone!!!

Posting Permissions

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