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

  • Question

  • 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.

    • Moved by Kevin Linq Friday, September 23, 2016 2:35 AM
    Thursday, September 22, 2016 5:58 PM

Answers

All replies

  • Hi  TatsuSheva :

    Thank you for posting here.

    Since your issue is related to office development, I will move your thread to office development general . 

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.

    Here is the link of office development general forum:https://social.msdn.microsoft.com/Forums/office/en-US/home?category=officedev&filter=alltypes&sort=lastpostdesc

    If you have anything else regarding C# programming , please feel free to let me know . 

    Best Regards,

    Kevin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Friday, September 23, 2016 2:32 AM
  • >>>But  the error I got is that it doesn't recognize this: "ApplicationEvents4_Event"...

    According to your description, as far as I know that PowerPoint do not support Quit event, you could refer to Powerpoint Application Events.

    In addition if you have any feedback for PowerPoint, please feel free to submit them to User Voice:

    https://powerpoint.uservoice.com/

    Thanks for your understanding.
    • Proposed as answer by David_JunFeng Friday, September 30, 2016 5:30 AM
    • Marked as answer by David_JunFeng Monday, October 10, 2016 1:20 AM
    Monday, September 26, 2016 5:21 AM