ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel.Application.Quit() (https://www.excelbanter.com/excel-programming/324834-excel-application-quit.html)

Mircea Pleteriu

Excel.Application.Quit()
 
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




AA2e72E

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






All times are GMT +1. The time now is 08:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com