Jim Tat

Jim Tat

  • NA
  • 52
  • 47.2k

How to open and close an instance of powerpoint in C#

Sep 22 2016 7:52 AM
Hello, I am doing an application in which I launch Office App like Word, PowerPoint etc<br /> So, I did for the Word App but now I am doing for the Powerpoint App but I don't know how to put an event on the exit of an instance of Powerpoint and also create an instance of Powerpoint.<br /><div> Here is what I did for the Word App:</div><div>&nbsp;</div><div><div class="dp-highlighter"><ol start="1" class="dp-c"><li class="alt"><span><span class="keyword">using</span><span>&nbsp;wd&nbsp;=&nbsp;Microsoft.Office.Interop.Word;&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;</span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;&nbsp;wd.Application&nbsp;wdApp&nbsp;=&nbsp;<span class="keyword">new</span><span>&nbsp;wd.Application();&nbsp;&nbsp;</span></span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;wdApp.Visible&nbsp;=&nbsp;<span class="keyword">true</span><span>;&nbsp;&nbsp;</span></span></li><li class="alt"><span>&nbsp;&nbsp;&nbsp;</span></li><li class=""><span>&nbsp;&nbsp;&nbsp;&nbsp;((wd.ApplicationEvents4_Event)wdApp).Quit&nbsp;+=&nbsp;()&nbsp;=&gt;&nbsp;{&nbsp;MessageBox.Show(<span class="string">"Exited!"</span><span>);&nbsp;};&nbsp; <br /></span></span></li></ol></div> </div>

Answers (5)