Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

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

$
0
0
Hello, I am doing an application in which I launch Office App like Word, PowerPoint etc
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.

Here is what I did for the Word App:

using wd = Microsoft.Office.Interop.Word;

    wd.Application wdApp = new wd.Application();
    wdApp.Visible = true;

    ((wd.ApplicationEvents4_Event)wdApp).Quit += () => { MessageBox.Show("Exited!"); };

And here is what I did for the Powerpoint App:

using wd = Microsoft.Office.Interop.PowerPoint;

    wd.Application wdApp = new wd.Application();
    wdApp.Visible = true;

    ((wd.ApplicationEvents4_Event)wdApp).Quit += () => { MessageBox.Show("Exited!"); };

But  the error I got is that it doesn't recognize this: "ApplicationEvents4_Event"...

Thank you.


Viewing all articles
Browse latest Browse all 2257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>