Page 1 of 1

COM Object method .Quit() not killing process

Posted: 25 Sep 2018, 13:31
by Stavencross
I spent about 6 hours this week struggling with powerpoint not quitting when I was calling the .Quit() method. I stumbled across :
https://stackoverflow.com/questions/319 ... ar-process
which lead me to
https://support.microsoft.com/en-us/hel ... l-studio-n

Although this is for C#/.net, the idea is the same. If you're passing your COM Obj around between functions, or using global vars, microsoft essentially keeps a counter of the times you called it. Hence, when you call ".Quit()" it kills the COM Obj, but NOT the program itself.

To resolve, Here's what I did:

Code: Select all


	global ppt := "" ;First, set your ComObj to null, this will reset microsoft's stupid counter.
	ppt := ComObjActive("PowerPoint.Application") ;reconnect to your COM obj
	ppt.Quit() ;It dies.
	
Just wanted to save someone the frustration I went through

Re: COM Object method .Quit() not killing process

Posted: 16 Mar 2019, 20:55
by IMEime
I do not have experience with ppt
but
in MS Excel, I made it a rule to kill it out;

Code: Select all

oExcel.Quit					; 	kill Object
oExcel =					; 	kill Process
On the contrary, only the first one is good enough for the MS Word