View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sandrina Sandrina is offline
external usenet poster
 
Posts: 4
Default 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 :)