+ Reply to Thread
Results 1 to 8 of 8

Lock Project

  1. #1
    Forum Contributor
    Join Date
    05-19-2004
    Location
    United States
    MS-Off Ver
    Office XP and Office 2003
    Posts
    127

    Lock Project

    I have a project that I am trying to lock with a password to prevent our users from changing it and seeing the code. I have gone into the Visual Basic code. I then selected Tools - VBA Project Properties. Then I went into the Protection tab and checked the box in Lock Project and entered a password. I then saved my file. When I open it up again and make a change on any of the sheets, it allows me to save the file even without putting in the password. I thought with the password set, you wouldn't be able to make changes and save it? Is there a way to prevent this because we don't want any of our users disabling the macros and then making changes to the sheets?

  2. #2
    Earl Kiosterud
    Guest

    Re: Lock Project

    LAF,

    Locking the projects hides the VBA code. If you don't want people to be
    able to open the workbook at all, you need to assign a Password to Open or
    Password to Modify, as needed, in the Tools dropdown of the Save-As dialog.
    This is for Excel 2002; you don't say which version you're using.

    Earl Kiosterud
    www.smokeylake.com

    "LAF" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I have a project that I am trying to lock with a password to prevent our
    > users from changing it and seeing the code. I have gone into the Visual
    > Basic code. I then selected Tools - VBA Project Properties. Then I
    > went into the Protection tab and checked the box in Lock Project and
    > entered a password. I then saved my file. When I open it up again and
    > make a change on any of the sheets, it allows me to save the file even
    > without putting in the password. I thought with the password set, you
    > wouldn't be able to make changes and save it? Is there a way to
    > prevent this because we don't want any of our users disabling the
    > macros and then making changes to the sheets?
    >
    >
    > --
    > LAF
    > ------------------------------------------------------------------------
    > LAF's Profile:
    > http://www.excelforum.com/member.php...fo&userid=9656
    > View this thread: http://www.excelforum.com/showthread...hreadid=482271
    >




  3. #3
    Jim Rech
    Guest

    Re: Lock Project

    VBE protection protects code in the VBE. It has no affect on changes in
    Excel or the ability to save a workbook. Your best protection against a
    user saving changes is to put the file in a location where users do not have
    Write rights. Of course they could save a copy elsewhere.

    Also, there is nothing you can do to prevent users from disabling macros.
    (Wouldn't virus writers have a field day if there were?)

    --
    Jim
    "LAF" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I have a project that I am trying to lock with a password to prevent our
    > users from changing it and seeing the code. I have gone into the Visual
    > Basic code. I then selected Tools - VBA Project Properties. Then I
    > went into the Protection tab and checked the box in Lock Project and
    > entered a password. I then saved my file. When I open it up again and
    > make a change on any of the sheets, it allows me to save the file even
    > without putting in the password. I thought with the password set, you
    > wouldn't be able to make changes and save it? Is there a way to
    > prevent this because we don't want any of our users disabling the
    > macros and then making changes to the sheets?
    >
    >
    > --
    > LAF
    > ------------------------------------------------------------------------
    > LAF's Profile:
    > http://www.excelforum.com/member.php...fo&userid=9656
    > View this thread: http://www.excelforum.com/showthread...hreadid=482271
    >




  4. #4
    Forum Contributor
    Join Date
    05-19-2004
    Location
    United States
    MS-Off Ver
    Office XP and Office 2003
    Posts
    127
    We are using Excel 2002. If I set a password to open the file, is there code I can put in the Workbook_Open event to automatically open the file when they Enable macros instead of having the user have to enter the pw. We don't want to give the pw to the users.

  5. #5
    Dave Peterson
    Guest

    Re: Lock Project

    If you don't want them to have to enter a password, then don't use one.

    Allowing the user to open the workbook just by clicking the enable macros button
    doesn't seem too secure to me.



    LAF wrote:
    >
    > We are using Excel 2002. If I set a password to open the file, is there
    > code I can put in the Workbook_Open event to automatically open the file
    > when they Enable macros instead of having the user have to enter the pw.
    > We don't want to give the pw to the users.
    >
    > --
    > LAF
    > ------------------------------------------------------------------------
    > LAF's Profile: http://www.excelforum.com/member.php...fo&userid=9656
    > View this thread: http://www.excelforum.com/showthread...hreadid=482271


    --

    Dave Peterson

  6. #6
    Forum Contributor
    Join Date
    05-19-2004
    Location
    United States
    MS-Off Ver
    Office XP and Office 2003
    Posts
    127
    In my file, when they enable macros, I have code that protects the sheets so that they can't change them. The problem is that if they open the file and disable macros, we don't want them to make any changes to the sheets and then save the file. That is why I need to have a pw or something when the open the file, so that if they disable macros, they would need the pw (but we wouldn't give it to our users to prevent them from making changes to the file). When I enable macros, I want code that automatically enter the pw for them.

  7. #7
    Dave Peterson
    Guest

    Re: Lock Project

    First, both VBA Project and worksheet/workbook protection (via tools|protection
    dialog) is very easy to break. So all your techniques (including the following)
    can still fail with an experienced user--or a dedicated snooper.

    But you may want to consider another alternative.

    Give the that workbook a nice password to open. But don't share it with anyone
    (except your out-of-office backup person).

    Then create a dummy workbook that opens the workbook automatically when it's
    opened. If the user disables macros, then the code in the dummy workbook can't
    open the real workbook. (Have some notes on the first worksheet explain that if
    the message doesn't go way, then they should close this workbook and open it
    with macros enabled. If macros are enabled, then this message will disappear
    pretty quickly.)

    If the user allows macros, then the dummy workbook opens the real workbook and
    closes itself.

    This is what the code in the dummy workbook could look like:

    Option Explicit
    Sub auto_open()
    Workbooks.Open Filename:="\\path\path\path\book2.xls", _
    UpdateLinks:=1, Password:="hithere"
    ThisWorkbook.Close savechanges:=False
    End Sub

    or

    Option Explicit
    Sub auto_open()
    Workbooks.Open Filename:=thisworkbook.path & "\book2.xls", _
    UpdateLinks:=1, Password:="hithere"
    ThisWorkbook.Close savechanges:=False
    End Sub

    Remember to protect that project, too--else someone may see the password to the
    real workbook.

    LAF wrote:
    >
    > In my file, when they enable macros, I have code that protects the
    > sheets so that they can't change them. The problem is that if they
    > open the file and disable macros, we don't want them to make any
    > changes to the sheets and then save the file. That is why I need to
    > have a pw or something when the open the file, so that if they disable
    > macros, they would need the pw (but we wouldn't give it to our users to
    > prevent them from making changes to the file). When I enable macros, I
    > want code that automatically enter the pw for them.
    >
    > --
    > LAF
    > ------------------------------------------------------------------------
    > LAF's Profile: http://www.excelforum.com/member.php...fo&userid=9656
    > View this thread: http://www.excelforum.com/showthread...hreadid=482271


    --

    Dave Peterson

  8. #8
    Simon Chang
    Guest

    Re: Lock Project

    Easy way, you have to choice to secure your workbook.
    Go to menus (Tools > Options > Security > Password to open / Password to
    modify).

    Create a password using macros is not really effective.

    Good luck.

    "LAF" <[email protected]> wrote in message
    news:[email protected]...
    >
    > We are using Excel 2002. If I set a password to open the file, is there
    > code I can put in the Workbook_Open event to automatically open the file
    > when they Enable macros instead of having the user have to enter the pw.
    > We don't want to give the pw to the users.
    >
    >
    > --
    > LAF
    > ------------------------------------------------------------------------
    > LAF's Profile:

    http://www.excelforum.com/member.php...fo&userid=9656
    > View this thread: http://www.excelforum.com/showthread...hreadid=482271
    >




+ 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