Consulting

Results 1 to 9 of 9

Thread: Protection for Excel Sheet

  1. #1
    VBAX Regular
    Joined
    Mar 2005
    Posts
    13
    Location

    Protection for Excel Sheet

    Hell everyone:

    I have written a script for an invoice, which I need to send to a prospective client.

    I am very new to programming, I have used the search help files, however, there are so many proctection for objects, Protection for property.

    All I want to do is protect the actual VBA, so that the end user cannot change the script.

    "Don't forget to cover 'Cut' as well as 'Copy' and to protect your VBA with a password."

    How do I do the above

    Thanks in advance

    Dillon
    Life is so much better when we can learn from each other.

  2. #2
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    VBA code is in one of the VBAProject modules for the xls file. Open the VB editor and right click on the VBAProject. Navigate to VBAProject Properties and then to the Protection Tab. Click the Lock project for viewing box and enter a relevant password (twice). Make sure you write down the password Click OK. The VBAProject remains viewable until you save and close the file. When you reopen the file and attempt to view the VBA code, you will be asked for the password. .

    This method is pretty secure. There are ways to crack it but I suspect that this is adequate for your purposes -- after all, you are probably just trying to keep honest people honest.

    You may also want to consider adding code to the Workbook_Open procedure to quit the application if certain criteria are not met. For example, you may wish to supply the VBA script(s) to the client for a month of evaluation. You could add a date check in the Workbook_Open proc to ensure that the client only gets 30 days of free evaluation. A really smart client can get around that by resetting the system clock. You can circumvent that by writing "check data" to a hidden and protected sheet so you will know if the client fiddles with the system clock.

  3. #3
    VBAX Regular
    Joined
    Mar 2005
    Posts
    13
    Location
    Hello MWE:

    I looked through the bible for 97, and I found the procedure, however, I use Excel 2002.

    I have tried, although, when I close, and reopen, I do not get a request for a password; I will follow your instructions.

    thank you very much for your support, and guidance.
    ___________________________________________________
    UPDATE: MWE, I have received the password request, as soon as I went back into the VBA Editior.

    Again, thank you so much!

    dillon
    Life is so much better when we can learn from each other.

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Master
    Joined
    Jan 2005
    Location
    Porto Alegre - RS - Brasil
    Posts
    1,219
    Location
    Hi dillon,

    dont forget to set it solved if its done.

    Simply hit Thread Tool -> Mark Solved.
    Best Regards,

    Carlos Paleo.

    To every problem there is a solution, even if I dont know it, so this posting is provided "AS IS" with no warranties.

    If Debugging is harder than writing a program and your code is as good as you can possibly make
    it, then by definition you're not smart enough to debug it.




    http://www.mugrs.org

  5. #5
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    Quote Originally Posted by dillon65
    Hello MWE:

    I looked through the bible for 97, and I found the procedure, however, I use Excel 2002.

    I have tried, although, when I close, and reopen, I do not get a request for a password; I will follow your instructions.

    thank you very much for your support, and guidance.
    ___________________________________________________
    UPDATE: MWE, I have received the password request, as soon as I went back into the VBA Editior.

    Again, thank you so much!

    dillon
    Dillon: I should have mentioned that the request for password would occur when you/user attempted to open the protected project in the VBE.

    Glad it worked out for you.

    MWE

  6. #6
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    Password setting in the VBE, as far as I can tell, doesn't really *take* until you close and reopen the file. In other words, during development, you can go in and out of there (sort of like you can a website that you're logged into, but you need to log in again after closing your browser).
    ~Anne Troy

  7. #7
    VBAX Regular
    Joined
    Mar 2005
    Posts
    13
    Location
    Hello MWE, Dreamboat, Paleo:

    Thank you for your support, I will glady remember to close out the thread.

    Again, thank you!

    Denise
    Life is so much better when we can learn from each other.

  8. #8
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    Quote Originally Posted by Dreamboat
    Password setting in the VBE, as far as I can tell, doesn't really *take* until you close and reopen the file. In other words, during development, you can go in and out of there (sort of like you can a website that you're logged into, but you need to log in again after closing your browser).
    Quite true; and that is why I emphasized writing down the password. It is all too easy to password protect the VBAProject, continue to work for a while and then close the file without consciously thinking about the password. Several days later you resume work on that file and unless you are consistent in password choices or have an unusually good memory, you may spend some non-productive time trying to remember what the password is.

  9. #9
    Administrator
    VP-Knowledge Base VBAX Master
    Joined
    Jan 2005
    Location
    Porto Alegre - RS - Brasil
    Posts
    1,219
    Location
    Hi MWE,

    thats why password crackers are being built everyday, , that really happens a lot and I endorse MWE recommendation.
    Best Regards,

    Carlos Paleo.

    To every problem there is a solution, even if I dont know it, so this posting is provided "AS IS" with no warranties.

    If Debugging is harder than writing a program and your code is as good as you can possibly make
    it, then by definition you're not smart enough to debug it.




    http://www.mugrs.org

Posting Permissions

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