0
votes

I open a presentation in slide show mode using the followoing code: (note that str_PresFileOpen is a string that contains the paht of the file)

Process.Start("powerpnt", "/s """ & str_PresFileOpen & """")

But this causes a problem - once I open a powerpoint ppresentation in slideshow mode, I can't manage to open another one in slideshow mode (using the same code).

How can I open more than one presentation in slideshow mode simultaneously? And by this I mean I open one and then after a while the user may click to open another presentation file - and this file I want to also open in slideshow mode.

2

2 Answers

0
votes

You can have any number of presentations open, in slide show mode or not, within a single instance of PowerPoint, but you can have only one instance of PowerPoint.

I'm guessing that Process.Start tries to open a new instance of PowerPoint, so it might not work for what you're after. Automating the existing instance of PPT to open a second (third, fourth ...) file would do the job.

0
votes

After researching interop - I managed to write the following code and it works - it opens multiple presentations in slideshow mode:

Private Sub OpenSlideShow(FullPath As String)
Dim powerpointApp = New Microsoft.Office.Interop.PowerPoint.Application()
powerpointApp.Visible = MsoTriState.msoTrue
Dim presentaions = powerpointApp.Presentations
Dim myPresentation = presentaions.Open(FullPath, MsoTriState.msoTrue, MsoTriState.msoFalse,MsoTriState.msoFalse)
Dim slideShowSettings = myPresentation.SlideShowSettings
slideShowSettings.Run()
End Sub

Note - one has to import the following:

Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop

What this code does is that it doesn't try to open the powerpoint process again and again (this wion't work) but it opens additional instances of powerpoint and this is why it works. Imports System.Runtime.InteropServices