+ Reply to Thread
Results 1 to 4 of 4

Prevent Workbook from Saving Unless the Username Matches

  1. #1
    Registered User
    Join Date
    09-13-2017
    Location
    United States
    MS-Off Ver
    MS Office 365
    Posts
    43

    Prevent Workbook from Saving Unless the Username Matches

    Hi,

    This was a curious thought and I have been googling to see if it is possible but couldn't find a solution. So I was hoping to prevent the workbook from saving unless the username (either excel username or the computer username) matches the set username. For example, if your username isn't John Smith, then you cannot save the workbook. If your username is John Smith, then you can save the workbook.

    Thank you!

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Prevent Workbook from Saving Unless the Username Matches

    Try this code
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Prevent Workbook from Saving Unless the Username Matches

    Place the following code on ThisWorkbook Module for BeforeSave Event.

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Registered User
    Join Date
    09-13-2017
    Location
    United States
    MS-Off Ver
    MS Office 365
    Posts
    43

    Re: Prevent Workbook from Saving Unless the Username Matches

    Thank you YasserKhalil and Sktneer for you solution. Both of your solution work but I was wondering can I add a second user to allow the second user to save?
    For example:
    Please Login or Register  to view this content.
    would this work? Thank you

    Answer: Shouldn't use OR when I am using "<>". I should be using "And" when I use "<>" or if I use "=" then I should use "Or". Thank you all again.
    Last edited by RXcel; 04-30-2018 at 11:29 PM. Reason: Found a solution

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Prevent Excel workbook closing saving if the mandatory cells not filled in
    By pearlite007 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 02-07-2017, 05:12 PM
  2. [SOLVED] Prevent anyone "Saving" a shared workbook
    By Anarchus in forum Excel General
    Replies: 3
    Last Post: 10-19-2016, 08:07 AM
  3. [SOLVED] how to prevent debug error when I insert new rows with datetime & username stamp
    By ladynana17 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-18-2015, 01:15 PM
  4. [SOLVED] Error checking code that will prevent over-writing of a workbook when saving to PDF
    By mike_vr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-02-2012, 10:11 AM
  5. Replies: 4
    Last Post: 12-22-2006, 02:27 PM
  6. [SOLVED] Saving username into a cell
    By thudson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-24-2006, 06:23 PM
  7. Prevent user from saving workbook
    By keithl816 in forum Excel General
    Replies: 3
    Last Post: 01-15-2006, 06:30 PM

Tags for this Thread

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