+ Reply to Thread
Results 1 to 3 of 3

Prevent others from running my macros

Hybrid View

  1. #1
    Frederick Chow
    Guest

    Prevent others from running my macros

    Hi all,

    Very often I have to send my Excel files (with macros) to others. Is there
    any simple way of preventing third parties from running the macros in those
    files? Thanks.

    Frederick Chow
    Hong Kong.



  2. #2
    JE McGimpsey
    Guest

    Re: Prevent others from running my macros

    The simple way would be to require a password to run the macro:

    Public Sub MyMacro()
    Const sPWORD As String = "drowssap"
    Dim vResponse As Variant
    Do
    vResponse = Application.InputBox("Password: ", Type:=2)
    If vResponse = False Then Exit Sub 'User Cancelled
    Loop Until vResponse = sPWORD
    'your code here
    End Sub

    Then protecting your code (Tools/Project Properties in the VBE).

    However, that will not keep anyone with the gumption to find these
    newsgroups from finding a way to see/run your macros:

    http://www.mcgimpsey.com/excel/fileandvbapwords.html

    A more secure way is to put your code in a separate add-in so that it's
    never sent to the others.



    In article <ubTkGmAAGHA.2812@TK2MSFTNGP09.phx.gbl>,
    "Frederick Chow" <PleaseRemoveThishkmusc@yahoo.com> wrote:

    > Hi all,
    >
    > Very often I have to send my Excel files (with macros) to others. Is there
    > any simple way of preventing third parties from running the macros in those
    > files? Thanks.


  3. #3
    Frederick Chow
    Guest

    Re: Prevent others from running my macros

    Thanks a lot. A textbox asking for a password is a workable solution.

    Frederick Chow
    "JE McGimpsey" <jemcgimpsey@mvps.org> wrote in message
    news:jemcgimpsey-0D7CA9.10361813122005@msnews.microsoft.com...
    > The simple way would be to require a password to run the macro:
    >
    > Public Sub MyMacro()
    > Const sPWORD As String = "drowssap"
    > Dim vResponse As Variant
    > Do
    > vResponse = Application.InputBox("Password: ", Type:=2)
    > If vResponse = False Then Exit Sub 'User Cancelled
    > Loop Until vResponse = sPWORD
    > 'your code here
    > End Sub
    >
    > Then protecting your code (Tools/Project Properties in the VBE).
    >
    > However, that will not keep anyone with the gumption to find these
    > newsgroups from finding a way to see/run your macros:
    >
    > http://www.mcgimpsey.com/excel/fileandvbapwords.html
    >
    > A more secure way is to put your code in a separate add-in so that it's
    > never sent to the others.
    >
    >
    >
    > In article <ubTkGmAAGHA.2812@TK2MSFTNGP09.phx.gbl>,
    > "Frederick Chow" <PleaseRemoveThishkmusc@yahoo.com> wrote:
    >
    >> Hi all,
    >>
    >> Very often I have to send my Excel files (with macros) to others. Is
    >> there
    >> any simple way of preventing third parties from running the macros in
    >> those
    >> files? Thanks.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1