Closing office apps with c#

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is probably something simple...
I'm trying to close a Powerpoint application from c# using:

PptApplication.Quit();
PptApplication = null;
GC.Collect();

I need all trace of the it to disappear immediatly, hence why I am calling
gabage collection, however it dosn't seem to disappear from the processes
list on task manager immediately (although if I wait around it does). Is
there a cleaner way to close powerpoint down?

Cheers
 
You can use GC.WaitForPendingFinalizers() to be sure all finalizers have
completed before moving on
You can also terminate the process
Process.GetProcessesByName("powerpnt.exe")[0].Close() or .Kill() to stop the
process immediately
 

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

Back
Top