Consulting

Results 1 to 6 of 6

Thread: Password protect and unprotect a worksheet/workbook

  1. #1
    VBAX Newbie
    Joined
    Dec 2018
    Posts
    4
    Location

    Password protect and unprotect a worksheet/workbook

    Hi,

    I'm struggling with the following:

    I have a workbook with different worksheets containing people's working hours and working schedules.

    There are two sheets that are allways visible: Agenda and Tasks

    These sheets should be allways visible for every user, but they should only be read-only, except for the administrator of the file.

    Then there are five more sheets, one per employee containing the working hours of that employee. The emloyee who logs in should only be able to see the sheets Agenda, Tasks and his individual sheet, all in read only modus.

    The administrator that logs in should be able to see everything and needs write access to all sheets.

    I don't know how to accomplish this, I even don't know if it's possible at all…


    What I've got till now:

    * Employees can log in to the workbook and can see 3 sheets, but they have write access and thats not as it should be.
    * The Administrator can't login :-)

    Can anyone help me out?


    Thanks!
    Tommy

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    How do you tell who is the Admin and which employee is accessing the workbook?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Newbie
    Joined
    Dec 2018
    Posts
    4
    Location
    Hi Paul , I use a login form for that.

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Quote Originally Posted by tomski View Post
    Hi Paul , I use a login form for that.
    I meant what parameters can the macro use to determine who is running the macro

    It sounds like the person's identification is a UF TextBox with some sort of name or ID?

    Many times people will use the ENVIRON("USERNAME")
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  5. #5
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Hi tomski!
    This may be a little inspiring to you.
    Please refer to the attached.
    Attached Files Attached Files
    Last edited by 大灰狼1976; 12-12-2018 at 12:56 AM.

  6. #6
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    I have revised a little, then if someone close the login form directly, The workbook will be automatically closed.
    Attached Files Attached Files

Posting Permissions

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