Excel does not request saving unsaved files in Application.Quit

Using Application.Quit in Excel VBA should initiate a default completion procedure, which includes asking the user to save any unsaved documents currently open in the application.

When testing on multiple systems (32-bit version of Excel 2010, 64-bit version of Windows 7), I found that some systems ask the user to save, and on some systems this is not.

We checked the settings on the systems (including enabling all macros and disabling protected browsing) to no avail. Even when using the same settings in different systems, no system forced the user to save their work until Excel was closed.

As if Application.DisplayAlerts is set to False, but it is not. We even tried the following lines of code:

Application.DisplayAlerts = True Application.Quit 

In some systems, even this does not allow the user to save unsaved documents. Excel just shuts down unexpectedly.

Any help resolving this is greatly appreciated.

Thanks!

Update in response to comments:

I double-checked the Workbooks.Saved property for all books that were open and unsaved, and this was incorrect immediately before Application.Quit, so this should not be a problem.

I also just checked a simple test. I opened the book, edited it and executed Application.Quit in the nearest VBA window. Excel exits without asking to save the unsaved file. This indicates that this is something in my Excel setup and has nothing to do with my application.

+4
source share
3 answers

Disabling the Solver add-in function returns normal behavior.

+5
source

I used the following code to save the book and close the application

 ActiveWorkbook.Save Application.Quit 

but after the crash, excel asked me to disconnect Solver. After disabling the solver, Excel did not recognize the save command, and he kept asking if I wanted to save the workbook despite the save command.

Then I realized that this error could be resolved by resolving the solver again ...

very strange

0
source

I tried the same thing that disabled the Solver add-in, and it did not work. I also decided to try disabling the Hstbar add-in. Both of them were turned off, and he began to work again.

0
source

Source: https://habr.com/ru/post/1385434/


All Articles