+ Reply to Thread
Results 1 to 28 of 28

How to set passwords?

  1. #1
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    How to set passwords?

    I haven't ever done anything with passwords/protection in excel.

    I have 2 workbooks. Workbook 1 is only one sheet. Workbook 2 has many sheets. They are used by two different groups and managed by a 3rd group. The 3rd group would like to remove themselves from the circle as what they do is very minor... they merely take information e-mailed to them from workbook 1 generated by a user form and they take that information and enter into a user form in workbook 2 that places the information elsewhere in book 2.

    It seems like it would be really easy to take and add the two workbooks together to allow group #3 to not be involved.

    One problem: Manager for group 1 doesn't want the Sheet#1 that displays at opening to be moved as it contains all the user forms used by them for the rest of the workbook and dosen't mind if that page is seen but doesn't want group 2 to be able to use that page.

    Additional problem: Neither manager wants group 2 to be able to be able to see any of the other pages (3-15.)

    My solution? Merge the two books by creating a new worksheet in workbook 2. Let both groups have the option to check this new workbook 2 out of sharepoint but to place two sets of passwords with-in the book. Password 1 would only allow users to use worksheet #2 and not "see" any other pages and Password 2 would allow users in other group to use page #1 as well as pages #3-15. Is anything like this possible??
    Last edited by LiLi1; 07-13-2010 at 02:02 PM. Reason: solved

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: How to set passwords?

    Here is an example, when the workbook is opened All but sheet1 is hidden,
    Enter the correct password and your sheet will Un-Hide. Macros must be enabled to be able to use the password UserForm
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    This is just the type of example I needed. Thanks so much!

    I've gotten it to somewhat work ... have been playing around with it for awhile.

    The problem I am having is that it doesn't seem to "require" you to enter passwords to see the sheets. I can merely right click on tab and choose unhide and it opens a list and I can choose any page I wish to see even without entering a password.

    Is there an solution to this problem?
    Last edited by LiLi1; 06-30-2010 at 12:16 PM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to set passwords?

    This has proven popular

    PASSWORD FORM4.zip
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    252

    Re: How to set passwords?

    In the example workbook posted by davesexcel, change the Visible property from False to xlSheetVeryHidden e.g. for the Workbook_Before close event:

    From:

    Please Login or Register  to view this content.
    To:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    I couldn't get that part of Dave's code to work it kept giving me some sort of object error when I attempted to close the file.
    If it makes a difference I am using excel 2007 I have tried to update the corner of my profile previously but for some reason it reverts back to the 2003 tag.
    I turned his closing code into a comment and replaced it with this in the general workbook file:

    Please Login or Register  to view this content.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to set passwords?

    Have you looked at my example?

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to set passwords?

    Your Excel version changed OK

  9. #9
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    The other problem I am having is that I can enter either password and only the larger set of worksheets opens.

    Please Login or Register  to view this content.
    Last edited by LiLi1; 06-30-2010 at 01:48 PM.

  10. #10
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    Roy,
    It appears to be blocked ... I was actually pretty surprised I could view the attachment Dave posted earlier...

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to set passwords?

    What's blocked? Click the link & a download page opens

  12. #12
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    I tried to change my opening code to the changes suggested above by doing this:

    Please Login or Register  to view this content.
    But I got an error code for the ending if without a beginning if

    so I made the end if a comment but then I get the error code:

    Run-time error '1004'

    Method 'Visible' of object 'Sheets'failed

    This is the same error code I was getting previously
    Last edited by LiLi1; 06-30-2010 at 02:07 PM.

  13. #13
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    Roy,
    I can't download it ... I click the right buttons but nothing happens

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to set passwords?

    It's been downloaded over 200 times from there. Are you on a works computer that might be blocking it?

  15. #15
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    Yes it's a work computer

  16. #16
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to set passwords?

    Possibly your IT won't allow the download
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    252

    Re: How to set passwords?

    Change Worksheets.Visible to ws.Visible and uncomment the End If:

    Quote Originally Posted by LiLi1 View Post
    I tried to change my opening code to the changes suggested above by doing this:

    Please Login or Register  to view this content.
    But I got an error code for the ending if without a beginning if

    so I made the end if a comment but then I get the error code:

    Run-time error '1004'

    Method 'Visible' of object 'Sheets'failed

    This is the same error code I was getting previously
    i.e.

    Please Login or Register  to view this content.
    EDIT:

    Thought it might be worth mentioning:

    Once you have got the VBA working you will need to lock the VBA Project for viewing. To do this:

    In Visual Basic Editor:
    Select Tools
    Select VBAProject Properties
    Select the Protection tab
    Tick Lock project for viewing and type and confirm a password
    Last edited by pb71; 06-30-2010 at 04:02 PM.

  18. #18
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    pb71 thanks I altered the opening code to what you suggested and that runs fine without any error messages.

    I also added the locked protection you suggested.

    I still however have the problem where the passwords themselves don't seem to do anything ... I can enter 888 in the box or 111 or the actual "passwords" and the larger set of the sheets still open up. See code I posted earlier.

    It doesn't seem to really matter what I typed in the box.... I can still also unhide any worksheet I want just by right clicking on the tab.
    Last edited by LiLi1; 06-30-2010 at 04:20 PM. Reason: spelling

  19. #19
    Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    252

    Re: How to set passwords?

    Is there any chance that you could post a copy of your workbook with any sensitive data removed?

    EDIT:
    With reference to your code above:

    Please Login or Register  to view this content.
    Change

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    You can also remove:
    Please Login or Register  to view this content.
    ...as worksheet A will always be visible
    Last edited by pb71; 06-30-2010 at 04:33 PM.

  20. #20
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    It ties into several different workbooks and I would have to purge an awful lot of data from it to do an example type workbook. I will try to play around with purging it and see what I can come up with tomorrow. Thanks!

  21. #21
    Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    252

    Re: How to set passwords?

    Is there any other code in addition to the example posted originally by davesexcel?

  22. #22
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    Yes pages and pages of VBA code ~10 sheets and ~12 modules of code and many user forms ~10 tied to vba code to e-mail, to SharePoint etc.
    Last edited by LiLi1; 06-30-2010 at 04:56 PM.

  23. #23
    Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    252

    Re: How to set passwords?

    I think it's probably best if you post an example workbook with the code you have so far. I have applied davesexcel's code to an example workbook and it works for me.

  24. #24
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    I didn't get a chance to play around with a dummy workbook today and I am ooto all next week. When I return I will post a workbook.. thanks for everyone's help so far.

  25. #25
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    Sorry for the time delay.

    Here's an example workbook... the suggestion to place "" marks around the passwords helped so that not any random typing opening the pages. However now nothing I enter works to unlock the pages..??

    When I attach a document, save this message, open the message and attempt to open the file 1) I get a message about trusting links ( it shouldn't have any links?) and 2) if I choose enable it tells me the file is locked for editing by myself??
    What am I doing wrong?
    Last edited by LiLi1; 07-13-2010 at 04:50 PM. Reason: removed attachment, no longer needed in thread

  26. #26
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    Re: How to set passwords?

    I messed around with the file several times but I still seem to have same issues with uploading it... hopefully someone can access the file enough to be able to help.

  27. #27
    Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    252

    Re: How to set passwords?

    LiLi1,

    Change the following in your workbook:

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    and

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.

  28. #28
    Forum Contributor
    Join Date
    01-14-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    125

    [Solved] How to set passwords?

    Thanks!!!!!
    TextBox1 to Passwordentrybox makes so much sense....total newbie error, works much better now

    Changed coding for sheets reference as well and works.

    Took me a few attempts but seems to work great!
    Last edited by LiLi1; 07-13-2010 at 02:01 PM. Reason: Solved

+ 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