+ Reply to Thread
Results 1 to 17 of 17

Macro to turn off save box when user click close button

  1. #1
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Macro to turn off save box when user click close button

    Hi,

    I noticed that when we use the following function

    OFFSET(),
    NOW(),
    TODAY() and so on

    the formula is running and calculating every time workbook is opened . This will cause save box pop up when user click on closing button. How to apply workbook change event to turn off the save box?

    I guess like this but not sure how to apply? any help would be much appreciated
    Please Login or Register  to view this content.
    1. Thank those who have helped you by clicking the Star * below the post.
    2. Please mark your post [SOLVED] if it has been answered satisfactorily.

    Sincerely,
    Farid

  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: Macro to turn off save box when user click close button

    Not sure what you mean by "Save Box". If a user makes changes to a workbook and clicks the close button without saving, Excel automatically displays a dialog box asking if the user wants to save the changes they made. If you disable that feature, then changes that the user wants to save could get discarded. If you are getting the SaveAs dialog box displayed, then it is because the user has created a new file and Excel does not know what to do with it. But that would only appear if the user clicked "Save", not the close button. Both of these features are built into the system software to prevent loss of data by the user forgetting to save their work, or to allow them the option to discard their changes. You could set the calculation to manual, but then you would need to remember to run it mannually to get any values calculated.

    Maybe I don't understand the problem.
    Last edited by JLGWhiz; 03-17-2016 at 08:32 PM.

  3. #3
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Macro to turn off save box when user click close button

    Hi,

    If you apply formula OFFSET function in your worbook, you will be prompted with save dialog box even though there is no changes made in the workbook.

    one more problem, even though you have just click on save button, you will be prompted again when click on closing button. Thus, I want to disable it
    Last edited by Faridwahidi; 03-17-2016 at 10:00 PM.

  4. #4
    Registered User
    Join Date
    03-06-2013
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Macro to turn off save box when user click close button

    Hi - If you want to disable the "do you wish to save" altogether then I use a "Auto _close" macro that turns off any prompt for saving...

    Please Login or Register  to view this content.
    Hope that helps- remember it closes the sheet without prompt to save whatever you do so be careful!!

    Andy

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to turn off save box when user click close button

    Of course if you want the workbook to be saved too then...

    Please Login or Register  to view this content.
    If the workbook is not read only the workbook will be saved when closing

    BWT: this is air code, not tested, but it's the idea
    Last edited by Keebellah; 03-18-2016 at 03:29 AM. Reason: Extra info
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  6. #6
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Macro to turn off save box when user click close button

    hi,

    The code above turn off dialog box BUT automatically save the workbook when user click on closing button. I don't want it to be automatically save to avoid incident of user made wrong changes.

    any help please

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to turn off save box when user click close button

    The just add a msgBox asking the user if he/she wishes to save.
    It's not THAT difficult

  8. #8
    Registered User
    Join Date
    03-06-2013
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Macro to turn off save box when user click close button

    Hi the code that is below closes, without saving or prompting for saving..

    Please Login or Register  to view this content.
    Andy

  9. #9
    Registered User
    Join Date
    03-06-2013
    Location
    UK
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Macro to turn off save box when user click close button

    Hi the code that is below closes, without saving or prompting for saving..

    Please Login or Register  to view this content.
    Andy

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to turn off save box when user click close button

    That is what the poster wants: HE DOES NOT ALWAYS WANT TO SAVE THE FILE....

    Please Login or Register  to view this content.
    Last edited by Keebellah; 03-21-2016 at 05:47 AM. Reason: forgot something

  11. #11
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Macro to turn off save box when user click close button

    hi Keebellah,


    You have created the code same as without VBA. Have you test it before?

    when I click on closing button, there is a pop up dialog box ask me to save or not.

    I do NOT want dialog box to pop up and I do NOT want it to save automatically. if you cannot resolve it, just ignore the thread, let others help.

  12. #12
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to turn off save box when user click close button

    I'll let others help.
    Small suggestion: start learning VBA yourself
    It's not that difficult, I learned.

  13. #13
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Macro to turn off save box when user click close button

    Hi Keebellah,

    Thanks for suggestion, I have started learning VBA after register in this forum over the past 2 years. Beginning last year, I have been trying to help VBA new entry level to resolve their problem. Approximately 15% of 591 my post were to help others rather than only asking question. Besides this forum, I have user account in MrExcel, Ozgrid and VBA Express. I have also manage to create complex Userform database for my department in my job.

    you can see over here
    http://www.excelforum.com/showthread...=1#post4322173
    http://www.excelforum.com/showthread...=1#post4341349
    http://www.excelforum.com/showthread...=1#post4337404
    http://www.excelforum.com/showthread...=1#post4336908
    http://www.excelforum.com/showthread...=1#post4341256
    http://www.excelforum.com/showthread...=1#post4334744
    http://www.excelforum.com/showthread...=1#post4326429
    http://www.excelforum.com/showthread...=1#post4167029
    http://www.excelforum.com/showthread...=1#post4152677
    http://www.excelforum.com/showthread...=1#post4160879
    http://www.excelforum.com/showthread...=1#post4214116
    http://www.excelforum.com/showthread...=1#post3976090
    http://www.excelforum.com/showthread...=1#post4210032
    Last edited by Faridwahidi; 03-21-2016 at 12:39 PM.

  14. #14
    Forum Contributor
    Join Date
    01-06-2015
    Location
    Huntsville, AL
    MS-Off Ver
    Office 365
    Posts
    185

    Re: Macro to turn off save box when user click close button

    I can make it work by using the code in this attached file. I would just copy the macros over and paste the code into the worksheet. Hope this helps you.
    Attached Files Attached Files

  15. #15
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to turn off save box when user click close button

    @Fariwahidi, congratulations, keep it up, especially your comments are really stimulating
    I have only been able to anser and help with ~6000 posts.

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

    Re: Macro to turn off save box when user click close button

    @Faridwahidi, as I tried to point out in my first post, you are fighting agaist the system software which is designed to prevent users from inadvertantly losing data by prematurely closing a file. So, the only way you will avoid the safety messages, is to fool the underlying system software into thinking you have done what needs to be done before closing a workbook. If you have your calculation set to automatic, and you have certain functions in your worksheet, like those you listed, then any change of any type will activate a calculation and set the save warning trigger. To do what you want, you will probably have to set calculation to manual, then use code similar to that posted by Chris McGlothen to put the file in a saved status. But to me, it is much simpler to just click the response buttons on the alert dialog box. If you disable the alert, there is a greater chance that your users, including you, will inadvertantly lose data because the file was not saved.

  17. #17
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Macro to turn off save box when user click close button

    Hello Faridwahidi,

    I'm with JLGWhiz on this one. Have a look at this similar thread:-

    http://www.excelforum.com/showthread...69#post4006369

    and then read through the thread mentioned in post #5, especially the very last post in that thread.

    You may then understand the complexities of what you are asking and the round-about issues that will arise.

    Cheerio,
    vcoolio.
    Last edited by vcoolio; 03-22-2016 at 07:48 AM.

+ 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. Replies: 1
    Last Post: 01-31-2016, 05:54 AM
  2. [SOLVED] Macro to Click 'X' Close Button Dependent on Screen Resolution
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-27-2015, 04:43 AM
  3. [SOLVED] close and open a Workbook with a macro button click
    By deano3141 in forum Excel General
    Replies: 3
    Last Post: 03-13-2014, 01:26 PM
  4. [SOLVED] Close userform with submit button click
    By mrapes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2012, 11:53 AM
  5. Automate Click, Save, Close
    By mbcebrian in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2011, 03:51 AM
  6. VBA User Form - Linking Close Button and Cancel Button
    By nivassrii in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-26-2011, 07:05 AM
  7. How to disable save message when I click the cross to close the file
    By hon123456 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2006, 02:20 AM

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