View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E AA2e72E is offline
external usenet poster
 
Posts: 400
Default Excel.Application.Quit()

The reason the Quit method does not terminate EXCEL is usually because
children of the application object still exist. Examine your code & set such
objects to NOTHING before calling the Quit method. BUT: if you must kill
Excel arbitrarily, try:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "PostMessageA"
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
As Long

Sub KillXL()
XL = FindWindow("XLMAIN", vbNullString)
If XL < 0 Then SendMessage XL, 16, 0, 0
End Sub

"Mircea Pleteriu" wrote:

Hi,

The Excel.Application.Quit() method quits the Excel framework but it does
not kill the EXCEL.EXE process.
How to kill the process?

Thanks,
Mircea