+ Reply to Thread
Results 1 to 4 of 4

Unprotecting a worksheet by username

  1. #1
    Registered User
    Join Date
    07-16-2007
    Location
    San Francisco, CA
    MS-Off Ver
    2010
    Posts
    93

    Unprotecting a worksheet by username

    HI All
    I would like to unlock the work sheet based on the username.
    However this code does not seems to be working,
    I would appreciate any assistance with this

    The object is that only these users have access to the locked cells on a sheet and those users not on the list would only have access to the unlocked cells.

    Please Login or Register  to view this content.
    Thank you for any assistance that you can offer.
    James
    Last edited by jwongsf; 12-07-2009 at 10:07 AM.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208

    Re: Unprotecting a worksheet by username

    The procedure you posted requires the users to have that exact name set up within Excel (under Tools > Options > General tab for Excel 2003). Are these set up in Excel? Or are you trying to capture their network user id?

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

    Re: Unprotecting a worksheet by username

    This works for me
    Please Login or Register  to view this content.
    Hope that helps.

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

    Free DataBaseForm example

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Unprotecting a worksheet by username

    Just re-iterating the others

    jasoncw's point is critical... anyone can change the Application.Username as outlined ... the NT id is of course (in theory) much more secure... if that's what you want to use (advised if in Network environment) then search:

    Please Login or Register  to view this content.
    and you should find plenty of info.

    As outlined by Roy's code VBA unlike native XL is case-sensitive by default (Apple <> apple) so either :

    a) coerce strings to common case when comparing

    or

    b) as Roy outlined - use

    Please Login or Register  to view this content.
    statement at head of the Module containing the code so as to make that Module case in-senstive (apple = Apple)
    Last edited by DonkeyOte; 12-04-2009 at 04:26 PM. Reason: typo

+ 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