View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default The old application.quit problem

When you close the workbook with the code, the code stops running. You can
try reorganizing like this:

Private Sub btnQuit_Click()
For Each w In Application.Workbooks
if w.Name < ThisWorkbook.Name then
w.Close False
End if
Next w
ThisWorkbook.Saved = True
Application.Quit
End Sub

--
Regards,
Tom Ogilvy

"phreud " wrote in message
...
Hello,

I'm totally lost. I've been searching through these forums and the
internet for an answer, but I can't solve this problem. I have a splash
screen (userform) from which users can open different forms in my
application. The splash screen also has a quit button which is supposed
to close Excel down, but it still apperas in the task manager.

From what I've read, I think I understand the problem, but I have no
idea how to solve it. I'm not creating new instances in my code? Not
sure if I should? Anyway, I'll give a brief explanation of what I'm
doing:

I have 1 workbook with 3 sheets. I have a userform acting as a splash
screen. The first thing I do when someone opens my xls file is (code
for ThisWorkbook):


Code:
--------------------
Private Sub Workbook_Open()
Application.Visible = False
frmSplash.Show
End Sub

--------------------


On my splash screen, I have a quit button with the following code:


Code:
--------------------
Private Sub btnQuit_Click()
For Each w In Application.Workbooks
w.Close False
Next w
Workbooks(1).Saved = True
ThisWorkbook.Close False
Application.Quit
--------------------


Clicking this still leaves the Excel process running. Can someone
please point me in the right direction?

Thankyou in advance.


---
Message posted from http://www.ExcelForum.com/