ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Exit from Excel window (https://www.excelbanter.com/excel-programming/348611-exit-excel-window.html)

Sandrina

Exit from Excel window
 
How do I close the whole Excel window? My goal is to exit without saving
data. If I write:
this.Close(false, missing, missing); (in ThisWorkbook_BeforeSave event)
the workbook closes without save, but the Excel window stays open, and thus
the project is still in running mode.
Thanks :)

Paul B

Exit from Excel window
 
Sandrina, use this,

Application.Quit

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Sandrina" wrote in message
...
How do I close the whole Excel window? My goal is to exit without saving
data. If I write:
this.Close(false, missing, missing); (in ThisWorkbook_BeforeSave event)
the workbook closes without save, but the Excel window stays open, and

thus
the project is still in running mode.
Thanks :)




chijanzen

Exit from Excel window
 
Sandrina:
try,

ThisWorkbook.Saved = True
Application.Quit

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Sandrina" wrote:

How do I close the whole Excel window? My goal is to exit without saving
data. If I write:
this.Close(false, missing, missing); (in ThisWorkbook_BeforeSave event)
the workbook closes without save, but the Excel window stays open, and thus
the project is still in running mode.
Thanks :)


Sandrina

Exit from Excel window
 
Thanks, but this doesn't work if you are in the BeforeSave event - it still
displays the SaveAs dialog. I solved the problem like this:

Application.DisplayAlerts = false;
Cancel = true; // the cancel that is provided as the BeforeSave argument
Application.Quit();
return;

"chijanzen" wrote:

Sandrina:
try,

ThisWorkbook.Saved = True
Application.Quit

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"Sandrina" wrote:

How do I close the whole Excel window? My goal is to exit without saving
data. If I write:
this.Close(false, missing, missing); (in ThisWorkbook_BeforeSave event)
the workbook closes without save, but the Excel window stays open, and thus
the project is still in running mode.
Thanks :)



All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com