+ Reply to Thread
Results 1 to 6 of 6

How to protect a code with password to avoid mishandling

  1. #1
    bobby
    Guest

    How to protect a code with password to avoid mishandling

    Hi,

    I have wriyyen a VBAcode in Excel Now i want the the code to be
    protected nor to be seen by others to avoid mishandling, as my
    worksheet is a shred one. help me how to protect the code.

    Regards

    Bobby.


  2. #2
    Nigel
    Guest

    Re: How to protect a code with password to avoid mishandling

    Goto to the VB editor (Alt-F11), then in the "Project Explorer" Window (if
    it is not visible then choose View->Project Explorer from the main menu)
    click on the VBA Project heading for the workbook code you wish to protect
    and right click, choose VBA Project Properties. In the project properties
    dialog choose protection and set the password etc.

    Next time you open the workbook you cannot view the code without the
    password.

    NOTE: This is not a totally secure method but will stop most tampering.

    --
    Cheers
    Nigel



    "bobby" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I have wriyyen a VBAcode in Excel Now i want the the code to be
    > protected nor to be seen by others to avoid mishandling, as my
    > worksheet is a shred one. help me how to protect the code.
    >
    > Regards
    >
    > Bobby.
    >




  3. #3
    bobby
    Guest

    Re: How to protect a code with password to avoid mishandling

    Hi Nigel,

    Thankyou for the answer.

    Thanks and Regards

    Bobby


  4. #4
    Nashua
    Guest

    Re: How to protect a code with password to avoid mishandling


    Nigel, is there any way to prevent the name of the macros from showing
    up in Tools, Macros, Macros...? Or can you at least prevent a user
    from running the macro?

    I posted this question yesterday, but got no responses:

    *****************************************************
    I've written an application and I've protected both the worksheets and
    the VBA code. But the macros still show in Tools, Macros, Macros...

    A user can still select and run a macro from the Tools menu. I want to
    control all macros from the buttons I have on the various sheets of the
    workbook. Can I hide the macro names and/or prevent "Run" from being
    chosen?
    *****************************************************

    Thanks, Nashua


    --
    Nashua
    ------------------------------------------------------------------------
    Nashua's Profile: http://www.highdots.com/forums/m1420
    View this thread: http://www.highdots.com/forums/t3081206


  5. #5
    Nigel
    Guest

    Re: How to protect a code with password to avoid mishandling

    If you declare your sub as Private then they will not be visible in the
    Run-Macro menu e.g.

    Private Sub Macro1()

    Also if you pass parameters then they will not be visible e.g.

    Sub Macro2(par1)

    This is also true for public subs e.g.

    Public Sub Macro3(par1)

    Take a look at the VB help for the Sub Statement for limitations of the
    scope of these different types of Subs.

    If also worth noting that Functions are also not visible in the Run-Macro
    menu.


    --
    Cheers
    Nigel



    "Nashua" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Nigel, is there any way to prevent the name of the macros from showing
    > up in Tools, Macros, Macros...? Or can you at least prevent a user
    > from running the macro?
    >
    > I posted this question yesterday, but got no responses:
    >
    > *****************************************************
    > I've written an application and I've protected both the worksheets and
    > the VBA code. But the macros still show in Tools, Macros, Macros...
    >
    > A user can still select and run a macro from the Tools menu. I want to
    > control all macros from the buttons I have on the various sheets of the
    > workbook. Can I hide the macro names and/or prevent "Run" from being
    > chosen?
    > *****************************************************
    >
    > Thanks, Nashua
    >
    >
    > --
    > Nashua
    > ------------------------------------------------------------------------
    > Nashua's Profile: http://www.highdots.com/forums/m1420
    > View this thread: http://www.highdots.com/forums/t3081206
    >




  6. #6
    Peter Rooney
    Guest

    Re: How to protect a code with password to avoid mishandling

    You can also add

    Option Private Module

    at the start of a module, to prevent the macros contained within it being
    displayed in the "Run" list.

    regards

    Pete





    "Nigel" wrote:

    > If you declare your sub as Private then they will not be visible in the
    > Run-Macro menu e.g.
    >
    > Private Sub Macro1()
    >
    > Also if you pass parameters then they will not be visible e.g.
    >
    > Sub Macro2(par1)
    >
    > This is also true for public subs e.g.
    >
    > Public Sub Macro3(par1)
    >
    > Take a look at the VB help for the Sub Statement for limitations of the
    > scope of these different types of Subs.
    >
    > If also worth noting that Functions are also not visible in the Run-Macro
    > menu.
    >
    >
    > --
    > Cheers
    > Nigel
    >
    >
    >
    > "Nashua" <[email protected]> wrote in message
    > news:[email protected]...
    > >
    > > Nigel, is there any way to prevent the name of the macros from showing
    > > up in Tools, Macros, Macros...? Or can you at least prevent a user
    > > from running the macro?
    > >
    > > I posted this question yesterday, but got no responses:
    > >
    > > *****************************************************
    > > I've written an application and I've protected both the worksheets and
    > > the VBA code. But the macros still show in Tools, Macros, Macros...
    > >
    > > A user can still select and run a macro from the Tools menu. I want to
    > > control all macros from the buttons I have on the various sheets of the
    > > workbook. Can I hide the macro names and/or prevent "Run" from being
    > > chosen?
    > > *****************************************************
    > >
    > > Thanks, Nashua
    > >
    > >
    > > --
    > > Nashua
    > > ------------------------------------------------------------------------
    > > Nashua's Profile: http://www.highdots.com/forums/m1420
    > > View this thread: http://www.highdots.com/forums/t3081206
    > >

    >
    >
    >


+ 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