Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Excel remaining open on workbook exit

Hi,

I want my workbook to not prompt the user to save it on exit. This is
because the form is showing information from files that the user
selects and when they close the workshhet I want it to remain in the
state it was in when the opened it first.

So, I use the following code to block the "Save" request -

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.EnableEvents = False
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub

The problem is that if I press the exit botton fo rthe excel
application, the workbook closes but excel remains open. How might I
fix this?

Thanks,

Aine.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default Excel remaining open on workbook exit

Hi,
Fixing your code maybe help:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.EnableEvents = False
Application.DisplayAlerts = False
Application.Quit 'this is the point.....
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub

--
Regards,

Halim



" wrote:

Hi,

I want my workbook to not prompt the user to save it on exit. This is
because the form is showing information from files that the user
selects and when they close the workshhet I want it to remain in the
state it was in when the opened it first.

So, I use the following code to block the "Save" request -

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Application.EnableEvents = False
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub

The problem is that if I press the exit botton fo rthe excel
application, the workbook closes but excel remains open. How might I
fix this?

Thanks,

Aine.


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
Opening Excel, Book1 opens, remains open with other workbook open DanieB Excel Discussion (Misc queries) 0 September 3rd 09 08:23 AM
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
How can I exit a workbook in Excel without closing the program? cosborn Excel Discussion (Misc queries) 1 September 21st 06 09:19 PM
How to glance at other workbook while remaining in MyForm.Listbox? count Excel Programming 0 November 7th 05 06:09 AM
I need to auto exit MS Excel when user leaves workbook open over . Jacques Excel Programming 2 February 18th 05 07:13 AM


All times are GMT +1. The time now is 09:19 PM.

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

About Us

"It's about Microsoft Excel"