+ Reply to Thread
Results 1 to 3 of 3

Help on Macro to Prohibit saving the workbook

  1. #1
    Registered User
    Join Date
    09-03-2014
    Location
    USA
    MS-Off Ver
    Mac 2011
    Posts
    13

    Help on Macro to Prohibit saving the workbook

    Hello,

    I have a excel workbook that needs to go on a company public computer. I have added the code below to prohibit people from copying this to other drives

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    MsgBox "You can't save this workbook!"
    Cancel = True

    End Sub


    The code works fine, but my question is this. On one page of the workbook, I have columns of Employee names that I use to populate drop down boxes on other sheets, I need this one sheet to be able to be updated and it doesn't need any type of protection. Can I add to the above code, that will allow to save changes to the one sheet when closed, but still not allow the workbook to be saved.

    Perhaps if I allowed saving to that particular drive, using the same name only, but I am not sure how to go about that.

    Thanks.

    R

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Help on Macro to Prohibit saving the workbook

    Hi, Big_Slick,

    the macro won´t be of much help when the users copy the workbook via Windows-Explorer.

    You might enable saving on any change on the worksheet. Maybe try putting the code behind that sheet:
    Please Login or Register  to view this content.
    Please mind that you should include a check if the worksheet is activated that any previous changes should be undone unless you want to make it possible to save those changes as well. Or you may try using a global variable to decide whether to store or not which may be turn False on Activating the sheet and True when De-Activing the sheet and may be inserted as well in a standrad module as in BeforeSave instead of True.

    Please have a look at Forum Rule #3 and wrap your procedure with code-tags as requested there.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    07-25-2007
    Posts
    40

    Re: Help on Macro to Prohibit saving the workbook

    Depending on your compnies IT user group policies, you could set the security to every can just read the file/folder except you/admin of the file. This sill stop copying of the file in explorer etc. Its not 100% fool proof but it will stop 99.9% of normal users

    This is done by the network administrator

+ 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. [SOLVED] Prohibit Saving an Excel Files if Conditions not Completed
    By piermyn in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2013, 08:46 PM
  2. [SOLVED] Macro to Saving Workbook Sheets as Separate Macro-Enabled Workbooks
    By puppetpalace in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-03-2013, 01:58 PM
  3. [SOLVED] Saving workbook as 2003 xls then reopen macro enabled workbook
    By JPalms in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2013, 01:24 PM
  4. Renaming Active.Workbook and saving it without saving Macro
    By Djwill in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2012, 03:09 AM
  5. prohibit closing a workbook
    By Christophero in forum Excel General
    Replies: 2
    Last Post: 04-04-2005, 01:06 PM

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