+ Reply to Thread
Results 1 to 5 of 5

Prevent Save by User Unless Condition is Met, but HOW DO I SAVE??

  1. #1
    Registered User
    Join Date
    12-17-2012
    Location
    us
    MS-Off Ver
    excel 2010
    Posts
    8

    Prevent Save by User Unless Condition is Met, but HOW DO I SAVE??

    Hi there,
    I have a code that I am using to prevent a user from saving an excel file until all required fields have been populated. The code works, but it works too well... I can't figure out how I CAN save the file so it can be used by others. Any thoughts? I need to save it in it's blank state to serve as a form. Thanks!

    Code is pasted within "This Workook" in vba editor

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Prevent Save by User Unless Condition is Met, but HOW DO I SAVE??

    Assuming the file was saved to a default directory prior to a non-compliant user trying to save it, it would still be residing in the default file without the non-compliant changes. Ergo, you could just close the open file without saving.

    Please Login or Register  to view this content.
    Your original file will still be intact.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    12-17-2012
    Location
    us
    MS-Off Ver
    excel 2010
    Posts
    8

    Re: Prevent Save by User Unless Condition is Met, but HOW DO I SAVE??

    Hi JLGWhiz,
    Once I insert the code I am unable to save the file myself since there the fields are blank. The previous version does not include vba condition. I need to get the file saved with the vba inserted and the condition not met. Basically I need some master override as the form designer. The form will be blank for users so they can fill out and only save once all fields complete. Does that help?

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Prevent Save by User Unless Condition is Met, but HOW DO I SAVE??

    Alt+F11 to bring up the VBA editor then Ctrl+G to go to the immediate window. Type this and hit return:

    Please Login or Register  to view this content.
    That should print your username as recognised by Excel. Now change your macro:

    Please Login or Register  to view this content.
    Replace "wbd" with whatever your username is. This allows you to override the save check.

    WBD
    Office 365 on Windows 11, looking for rep!

  5. #5
    Registered User
    Join Date
    12-17-2012
    Location
    us
    MS-Off Ver
    excel 2010
    Posts
    8

    Re: Prevent Save by User Unless Condition is Met, but HOW DO I SAVE??

    thank you much for the reply and fix!

+ 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. disable save/save as if condition is not met
    By thoandros in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 02-20-2021, 10:28 AM
  2. Replies: 6
    Last Post: 12-23-2018, 12:30 PM
  3. [SOLVED] How to Prevent Save or Save As for Excel File by VBA
    By ibuhary in forum Excel General
    Replies: 15
    Last Post: 12-15-2018, 11:06 PM
  4. How to prevent user to save doc if the rows does not meet the criteria
    By filipal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2017, 02:22 PM
  5. Replies: 1
    Last Post: 04-29-2016, 11:55 AM
  6. [SOLVED] Need to loop a macro to save images to file - but save to user defined directory.
    By superfurry in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2015, 07:49 AM
  7. [SOLVED] Disable save and prevent "Do you want to save" message from prompting for read-only file
    By hcyeap in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-12-2014, 12:29 AM

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