none
PowerPoint process is not quit, after end PowerPoint application!? RRS feed

  • Question

  • Greeting experts,

    I have a VB.NET Office AddIn and I create a Powerpoint application:

            Dim PPAnw As Microsoft.Office.Interop.PowerPoint.Application
            PPAnw = CreateObject("PowerPoint.Application")
            PPAnw.Visible = Microsoft.Office.Core.MsoTriState.msoTrue

            .......And then I create many shapes in the Slide.

    The program in the AddIn is finish and the Powerpoint is open. The user can edit the Slide, store and close PowerPoint.

    If the user close Powerpoint, the powerpoint process in the task manager is not cancled.

    Only I close my AddIn, then the Powerpoint process is also cleared.

    How can I cleard the powerpoint process, after that the user manually closed the PP application?

    Regards

      Michael

    Monday, July 21, 2014 10:15 PM

All replies

  • Hello Michael,

    Most probably you don't release underlying COM objects in the code. Use System.Runtime.InteropServices.Marshal.ReleaseComObject to release an PowerPoint object when you have finished using it. Then set a variable to Nothing in Visual Basic (null in C#) to release the reference to the object. See Systematically Releasing Objects for more information. The article describes Outlook, but the same can be applied to all Office applications.


    Tuesday, July 22, 2014 7:30 AM
  • Thank you for the information.

    I have found in your links followed VB code for Excel:

    Dim oApp As New Excel.Application() Dim oBook As Excel.Workbook = oApp.Workbooks.Add Dim oSheet As Excel.Worksheet = oApp.ActiveSheet oSheet = Nothing oBook.Close(False) oBook = Nothing oApp.Quit() oApp = Nothing

    But the problem is, that Excel is closed by the statement "oApp.Quit()".

    I want to create an Excel and insert in this Excel many information. The Excel should be open, that the user can see the information. Then the user can store and close the application - and then also all Excel processes in the task manager sould be closed.

    Is this possible?

    Tuesday, July 22, 2014 5:55 PM
  • Hi,

    Since you said you are developing a VB.NET Office add-in, I'm not sure about whether it is an Application-level add-in or Document-level add-in. No matter which one, as we known, the add-in will start up after running an application. So when you run the add-in, there will be an existing application running in the task manager.

    Then if you create a new application by "New Excel.Application()", there will be another new application running in the task manager. After you operate the workbook and close the application, the new created application will be quit automatically.

    So at this time, there still be one Excel application running in the task manager unless you close the first Excel application. About how add-in works with Microsoft Office Application, please refer to Architecture of Application-Level Add-Ins.

    In fact, if you just want to open a workbook, operate it, save and close it, I don't think you need to create a new application. You could just resort the existing Excel application.

    If you are developing an Application-level add-in, you could resort to the link below.

    Dim oApp As Excel.Application = Globals.ThisAddIn.Application

    If you are developing an Document-level add-in, you could resort to the link below.

    Dim oApp As Excel.Application = Globals.ThisWorkbook.Application


    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.

    Wednesday, July 23, 2014 4:32 AM
    Moderator
  • > Since you said you are developing a VB.NET Office add-in,Since you said you are developing a VB.NET Office add-in,

    > I'm not sure about whether it is an Application-level add-in or Document-level add-in.

    In concrete terms: I develop an MS-Project AddIn. And from this AddIn, I can open word, excel and powerpoint.
    For all three programs: I open the application, write text in document/sheet/slide and show the result to the user and then stops the AddIn Program.

    The user can store and close word/excel/powerpoint and it should closed all instances of word/excel/powerpint which are created from my AddIn.

    Can you help me?


    Wednesday, July 23, 2014 11:59 AM
  • Hi,

    Though you are developing Project Add-in, as I said, if you create a new application by "New Excel.Application()", there will be an Excel application running in the task manager. After you operate the workbook and close the application, the new created application will be quit automatically.

    Since you said your Excel/PowerPoint application cannot be quit automatically when closing, I think we have to narrow down it.

    Is there other add-in running?

    Could you mind sharing a whold code for us to understand you more?

    Have you tried the add-in in other machines?


    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, July 25, 2014 7:26 AM
    Moderator