Excel.Application.Quit()

  • Thread starter Thread starter Mircea Pleteriu
  • Start date Start date
M

Mircea Pleteriu

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top