Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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 :)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default 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 :)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default 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 :)

  #4   Report Post  
Posted to microsoft.public.excel.programming
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 :)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"X" at upper right of window to exit program is grayed out. Robert Excel Discussion (Misc queries) 3 September 2nd 08 10:48 PM
In Excel - how to delete new window created from window on tool ba Doug Excel Worksheet Functions 1 April 20th 06 09:22 PM
How do I undo the Excel, Window Menu, New Window command OLDFANG Excel Discussion (Misc queries) 2 March 17th 06 05:31 PM
Excel window will not exit. bawahoo Excel Programming 1 October 14th 04 08:00 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM


All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"