PPT2000: How to Start a PowerPoint 2000 Slide Show from Another Program (264112)



The information in this article applies to:

  • Microsoft PowerPoint 2000

This article was previously published under Q264112

SUMMARY

The following macro demonstrates how to start a Microsoft PowerPoint 2000 slide show from another Microsoft Office program by using Visual Basic for Applications and how to run a show that starts on a slide other than slide one.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

212536 OFF2000: How to Run Sample Code from Knowledge Base Articles

Code Sample

Before you use this code, you must set a reference to the Microsoft PowerPoint object model in the Microsoft Office program in which you are writing your code. Follow these steps to add the reference:
  1. Inside the Visual Basic Editor, on the Tools menu, click References.
  2. In the References - VBAProject dialog box, click to select the Microsoft PowerPoint 9.0 Object Library check box.
  3. Click OK.

    You now have a reference (in this project) to the PowerPoint 2000 object model.
Sub launchShow()
Dim oPPT As PowerPoint.Application
Dim oPres As PowerPoint.Presentation

' Set oPPT to the PowerPoint Application object.
'
   Set oPPT = CreateObject("Powerpoint.Application")

' Make PowerPoint visible.
'
   oPPT.Visible = msoTrue

' Set oPres to be equal to the Filename and path. Replace 
'
' ***<Filename>***
'
' with the correct path and file name to the presentation.
'
' For example:
' Set oPres = oPPT.Presentations.Open("c:\Presentations\Pres1.ppt")
' 
   Set oPres = oPPT.Presentations.Open("<Filename>")
   With oPres.SlideShowSettings

' Set the starting slide and ending slide range. Replace
'
' ***<Starting Index>***
'
' with the index number of first slide you want to start the
' slide show from. Replace
'
' ***<Ending Index>***
'
' with the slide index number you want to end the show on.
' 
' For example:
'      .StartingSlide = 3
'      .EndingSlide = 12
'
      .StartingSlide = <Starting Index>
      .EndingSlide = <Ending Index>

' Set the slide show to use the above range of slides.
' Then set the slide show to show full screen.
'
      .RangeType = ppShowSlideRange
      .ShowType = ppShowTypeSpeaker
 
' Run the slide show.
'
     .Run
   End With
End Sub
				

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbdtacode kbhowto kbProgramming KB264112