We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


PowerPoint in VB.NET Issues

Medium Priority
Last Modified: 2013-11-17
I am attempting to run a chunk of code that takes an array of selected slide indexes, and recreate a new slide deck using only the slides selected in the order selected by the user.  once this is done, ultimately I convert the new Slide Deck into a SWF file.  I am running into an issue running multiple instances of perpoint at the same time.  If run individually, I am sucessful.  But if I open another instance at the same time, it errors out at various points when a conflit occurs.  This is a server based application, so the Powerpoint would be running on the server and the result is downloaded from the web.  Office doesnt need to be installed on the user's machine.

Bonus issue 1:  How can i determine if an instance of Powerpoint is already running on the server?

Bonus Issue 2:  How can I close Powerpoint from this code?  objPPT.quit() doesnt work.
Sub convertPPTtoSWF()
        ' Create temporary array to loop through
        Dim arrSlides(2) As Integer
        arrSlides(0) = 2
        arrSlides(1) = 6
        arrSlides(2) = 4
        ' Open Powerpoint
        Dim objPPT As New PowerPoint.Application
        objPPT.Visible = MsoTriState.msoTrue
        objPPT.WindowState = PowerPoint.PpWindowState.ppWindowMinimized
        objPPT.ShowWindowsInTaskbar = MsoTriState.msoFalse
        ' Open Original Powerpoint Slide Deck, Save as TempOrig and TempNew, Close
        Dim objPres As PowerPoint.Presentation
        Dim varTimeStamp As String
        objPres = objPPT.Presentations.Open("c:\PPT\Test.ppt")
        varTimeStamp = Date.Now.Hour.ToString & Date.Now.Minute.ToString & Date.Now.Second.ToString & Date.Now.Millisecond.ToString
        objPres.SaveCopyAs("c:\PPT\" & varTimeStamp & "-Orig.ppt")
        objPres.SaveCopyAs("c:\PPT\" & varTimeStamp & ".ppt")
        ' Open Temp PowerPoint Slide Deck and delete all slides (Maintains Master)
        Dim objTempPres As PowerPoint.Presentation
        objTempPres = objPPT.Presentations.Open("c:\PPT\" & varTimeStamp & ".ppt")
        Dim objSlide As PowerPoint.Slide
        Do While objTempPres.Slides.Count > 0
            objSlide = objTempPres.Slides(1)
        Dim i As Integer
        Dim intNum As Integer
        ' Move desired slides from Original to Temp Deck
        Do While i < arrSlides.Length
            intNum = arrSlides(i)
            objTempPres.Slides.InsertFromFile("c:\PPT\" & varTimeStamp & "-Orig.ppt", objTempPres.Slides.Count, intNum, intNum)
            i += 1
        ' Save Temp Deck and Close Powerpoint
        ' Convert the Temp Deck
        Dim converter As New iSpring.PresentationConverter
        converter.OpenPresentation("c:\PPT\" & varTimeStamp & ".ppt")
        converter.GenerateFlash("C:\PPT\", varTimeStamp & ".swf", iSpring.OutputMode.OM_SOLID, "NavigationPanel", "")
        File.Delete("c:\PPT\" & varTimeStamp & ".ppt")
        File.Delete("c:\PPT\" & varTimeStamp & "-Orig.ppt")
    End Sub

Open in new window

Watch Question

Top Expert 2011
Normal mechanism to to check for an existing instance:

    On Error Resume Next
    Set pptApp = GetObject(, "POWERPOINT.APPLICATION")
    On Error GoTo 0
    If pptApp Is Nothing Then _
        Set pptApp = CreateObject("POWERPOINT.APPLICATION")

quit ought to work as soon as the calling application itself terminates, are you saying this doesn't happen.  Note explicitly after sending quit the ppt app stays open until the code that opened / connected to it terminates.


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


It is a web application.  So the Quit command doesnt close the app.  I can kill the process sucessfully, but that would kill all instances of the program making it a bit difficult to have concurrent users running at the same time.

If a quit command isnt feasible, how can I at least open the application to have multiple users running concurrently without stepping on each other's toes?  Is there a process to open multiple threads of Powerpoint?
Top Expert 2011

I am unable and unskilled in re running as web apps ... but that will not stop me having an opinion :o)

From my earlier checks PPT 2003 seems to open multiple instances, haven't tested 2007 so to help with the thought processes, what version of ppt is in use?

i.e. if you can test for multiple occurences then you can avoid killing the process and if only one then kill it.  Might that work as a kludge?



Its PowerPoint 2007, so only one window get opened, and only one Process gets generated.  Do you know of a way to force an application that works only in one instance to open in multiple?  This would be the workaround I need.
Top Expert 2011
By design it seems PPT only opens as a single instance, and this is the case with 2003 and 2007.  I have only heard of a single workaround which is here:


Since all you're doing is pulling in the selected slides and creating a Flash presentation I recommend that you save the slides as individual images in the first place.  This would allow you complete control of the application and remove the PowerPoint equation.

BTW, PowerPoint is a single instance app and I'm pretty sure that trying to run multiple instances from a server is a licensing violation.  However, having said that, you might get by with it if you set it up as a terminal server and everyone logs onto it as a sperate user.


Thank you so much for your help.  These solutions will work for this instance!  I was made aware of another route to take that uses a software solution to bypass PowerPoint called Aspose.  it does everything I need.  But thank you again for all your help!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.