Automating PP to start at particular slide No

  • Thread starter Thread starter Silvester
  • Start date Start date
S

Silvester

Hi,

How can I use automation to get PP to open an existing presentation and
start from say, Slide 3 of 8 ?

Code like
oPres.Slideshowsettings.Run
will cause PP to start at the 1st slide by default.

How can I overcome this using vba coding ?

TIA
 
After starting the slide show, navigate to the slide that you want. You
might want to use LockWindowsUpdate() Windows API to freeze windows update
so that viewers don't see the slide 1 before it is replaced by slide 3.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
Thanks Chirag for pointing me in the right direction.

I am unable to find the LockWindowsUpdate() api code...

Also, how would I navigate to slide, say 3 of 8 using vba automation code ?
 
Here goes the code:

---
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function LockWindowUpdate Lib "user32" ( _
ByVal hwndLock As Long) As Long

Sub LaunchSlideShowFromSlide(ByVal Pres As Presentation, _
ByVal SlideIndex As Long)

On Error Resume Next

LockWindowUpdate GetDesktopWindow()
With Pres.SlideShowSettings.Run
.View.GotoSlide SlideIndex
End With
LockWindowUpdate 0
End Sub

Sub Test()
LaunchSlideShowFromSlide ActivePresentation, 3
End Sub
---

Now the code is also available at
http://officeone.mvps.org/vba/launch_slide_show_from_slide.html

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
Glad to see this helpful code for my query up on the website. Thanks very
much Chirag.

I find that Powerpoint starts up visible at Slide 1 and then quickly goes to
Slide 3. How can we make sure PP stays hidden till Slide 3 is up ?

I am calling your code using the VBA automation below:

Dim oPPT
Dim oPPTDoc
Dim sPath
Dim sOutput

sPath = CurrentProject.Path & "\myTestPres.ppt"
Set oPPT = New PowerPoint.Application

Set oPPTDoc = oPPT.Presentations.Open(sPath, , , False)
Call LaunchSlideShowFromSlide(oPPTDoc, 3)

set oPPTDoc = nothing
set oPPT = nothing
 
Back
Top