Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Apr 2001
    Location
    SOUTH AFRICA
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA CODING PROTECTION (EXCEL97)

    Hi There,

    How do I protect my VBA coding & Macros from the users. I entered a password in the project properties, but it does not seem to work.

    Any ideas why? please

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: VBA CODING PROTECTION (EXCEL97)

    Rene,

    If you have entered a password, you need to save and close the file before it becomes effective. Try that and then re-open and see if it you cann acees the code without th epass word.

    Andrew

  3. #3
    Star Lounger
    Join Date
    Apr 2001
    Location
    SOUTH AFRICA
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA CODING PROTECTION (EXCEL97)

    Off course Andrew, thanks a lot

  4. #4
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA CODING PROTECTION (EXCEL97)

    One more thing to add... this protects the user from viewing your code but doesn't prevent them from manually executing any public macros that you wrote. In my project I did not want the user to view the list of public macros (F5 key in Excel) and the pressing Run as my code needs to be run in a certain way. If this is your situation too, you can prevent the macros from appearing in Excel's macro list by adding a dummy optional argument. This works because Excel only displays macros that have no arguments in that list.

    Example:

    ' this one shows up in list
    Public doMacro()

    ' this one does not
    Public doMacro(Optional dummyArg as Boolean = True)

    This does not prevent them from adding their own macros, however. Just stops them from using yours.

    Just thought I'd pass it on since your project would probably crash if the user randomly picked a macro to run from this list.

    FWIW, Deb <img src=/S/cool.gif border=0 alt=cool width=15 height=15>

  5. #5
    Star Lounger
    Join Date
    Apr 2001
    Location
    SOUTH AFRICA
    Posts
    74
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA CODING PROTECTION (EXCEL97)

    Hi There,

    Thank you very much for the usefull info about the PublicdoMacro() function.

  6. #6
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA CODING PROTECTION (EXCEL97)

    Another way to hide is:

    Private doMacro()
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  7. #7
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA CODING PROTECTION (EXCEL97)

    True, but that doesn't work if you NEED certain macros to be public so that they're accessible from other modules, that's the point I'm trying to make. In my case I had lots of public macros that were physically in different modules because I needed to call them from other places. I always use private if that sub/function isn't used outside of its own module.

    So if you don't want users to randomly pick one of your sub/functions to run (which causes your program to crash) then the only way to hide public subs/functions is to force a dummy argument (it's optional so that the calls that use them won't fail thinking they need to provide an argument).


    Deb <img src=/S/bummer.gif border=0 alt=bummer width=15 height=15>

Posting Permissions

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