The dialog "save & close" in Excel does not appear anymore after using "xlsread" or "xlswrite" commands in Matlab.

1 view (last 30 days)
After using the command xlsread on any .xls file, when I open the same file in Excel, I do some changes and then I close, no dialog appears anymore asking for saving before quitting. The same issue occurs when the command xlswrite is used. Therefore, the only way to save is by clicking the "save" button.
At least for the "xlsread" case, the issue seems to be due to the following setting: "Excel.DisplayAlerts = 0;" whithin the subfunction "xlsCleanup(Excel, filePath)"

Answers (1)

Image Analyst
Image Analyst on 31 Jan 2016
I do not observe that. Are you absolutely 100% sure you did not do a save in Excel and forgot about it? I'm pretty sure that the DisplayAlerts property is applied to the instance of Excel opened to the workbook and not to the workbook itself. In other words, xlsread() may set DisplayAlerts to false, but when you then open the workbook in Excel, the DisplayAlerts property was not saved with the workbook and recalled when you opened Excel. Moreover, even though starting with R2015b Excel is left running after xlsread() is done, that property does not seem to be maintained if you open the same workbook with Excel itself. I know because I actually tried it. I called xlsread(), then opened Excel changed something and quit, and it did in fact ask me if I wanted to save, contrary to what you say you experience. Maybe you can use PSR.exe to record a series of screenshots proving what you say happens.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!