VBA Terminate set app = NEW office applications after task complete (Zombie applications VBA), PIDs vs app.hwnd handles
''When launching excel from VBA inside another applicaiton like outlook, ''it doesn't end/kill cleanly. Excel.exe remains resident for some reason. ''This KILLS the excel, however the xcel.hwnd handle is nothte same as the ''PID needed to kill it''So this cleans out the the zombie applicaiton created ''by a set xcel = NEW excel.application #If VBA7 Then Declare PtrSafe Function GetWindowThreadProcessId Lib "user32" ( ByVal hWnd As LongPtr , lpdwProcessId As Long ) As Long Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( ByVal hWnd As LongPtr , ByVal lpOperation As String , ByVal lpFile As String , ByVal lpParameters As String , ByVal lpDirectory As String , ByVal nShowCmd As Long ) As LongPtr #Else Declare Function GetWindowThreadProcessId Lib "user32" ( ByVal hWnd As Long , lpdwProcessId As