Results 1 to 7 of 7

Thread: Protecting an Excel VB Module

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Richmond, VA, Chesterfield
    Posts
    3

    Post

    Greetings all
    Is there a way for me to make the code in my modules (I am using Excel VB) invisible or hidden somehow? I am trying to find a way to not make the code visible for someone else to copy unless they have a password or key.

    Thanks in advance to all
    Dimitri

  2. #2
    Guest

    Post

    If you protect the whole workbook then no one will be able to access any sheet etc without the password. This way they cannot access your module/macro

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Richmond, VA, Chesterfield
    Posts
    3

    Post

    RICH539006 Thanks for your reply and suggestion. I have considered your approach but I am concerned that by protecting the sheet this way the user won't be able to manipulate the worksheet. I want the user to be able to change stuff on the worksheet and to do so use my functions and modules but to not be able to duplicate the code and use it for his or her advantage without my permission..

    Again thanks for the reply...
    Dimitri

  4. #4
    Lively Member
    Join Date
    Oct 1999
    Posts
    101

    Post

    Hi Dimitri.

    Here's how to do it.

    In the Excel VBA Editor Window, select Tools...VBAProject Properties. Then Click on the Protection Tab. Put a check by Lock project for viewing and type in a password. Click OK.

    Now your VB-Excel Code is password protected! In order to test if it worked, save and close the workbook, open it back and try to look at the Code.

    All the best.

    Chris J.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Richmond, VA, Chesterfield
    Posts
    3

    Post

    ChrisJackson thanks for your reply....

    I have done exactly what you said but for some reason it is not working. Anyone can still see the code. I have tried to open the file after saving it and the code is right there. I also tried from another computer with a totally different login and nothing happened. I wonder if it is a flaw.. what you recommended seems to be the solution but at lease for my Excel 97 SR2 it is not working.

    Thanks for your reply
    Dimitri

  6. #6
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    One thing you could always try is to write a function to catch everything the user does. If they try to view your code, and you capture all the possible ways that they can do this, you can interupt it with a message saying they can't and then cancel the action.

  7. #7
    Lively Member
    Join Date
    Oct 1999
    Posts
    101

    Post

    Hi Dmitri.

    Be sure that you check "Lock Project for Viewing" when you create the Password. Try closing the VBA Editor Window after you Password protect it. In addition to saving the workbook, you have to CLOSE the workbook completely and re-open it again before the password takes effect.

    It should work. I've never had a problem with this before.

    All the best.

    Chris

Posting Permissions

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



Click Here to Expand Forum to Full Width