ID: Q147628
The information in this article applies to:
Moderate: Requires basic macro, coding, and interoperability skills.
This article demonstrates how to run a Microsoft PowerPoint for Windows 95 slide show from Microsoft Access for Windows 95 version 7.0 using OLE Automation.
This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access for Windows 95" manual.
NOTE: You must have both Microsoft PowerPoint for Windows 95 and Microsoft Access 7.0 installed on your computer. Also, you need to create a Microsoft PowerPoint presentation (.ppt) in order to use the technique described in this article.
The following example creates a form that has a command button on it for running a specific Microsoft PowerPoint presentation (.ppt) as a slide show in a separate window on the desktop.
To run a Microsoft PowerPoint slide show from a Microsoft Access form, follow these steps:
1. Create a new form not based on any table or query in Design View.
2. Add a command button to the form as follows:
Command button:
Name: runSlideShow
Caption: Start Slide Show
OnClick: =StartSlideShow()
3. On the View menu, click Code to open the Form module.
4. In the General section of the module, add the following function:
'--------------------------------------------------------------------
' This function sets an object variable to a specific presentation
' (.ppt) using the GetObject() function, which makes the connection
' between Microsoft PowerPoint (the OLE Automation Server) and
' Microsoft Access (the OLE Automation Controller). Then, it uses the
' Run method of the presentation object to run a slide show using the
' specified .ppt file. The Run method has a SlideShowType argument,
' which accepts the following values:
'
' Value Purpose
' ----------------------------------------------
' 0 To display the slideshow full screen.
' 1 To display the slideshow in a window.
'
' Note that if your database has a reference to the PowerPoint 7.0
' Object Library, you can substitute enumeration types for these
' values: ppSlideShowFullScreen for 0 and ppSlideShowWindow for 1.
'--------------------------------------------------------------------
Function startSlideShow()
Dim pptObject As Object
Set pptObject = GetObject("c:\msoffice\powerpnt\pptexample.ppt")
pptObject.slideshow.Run (1)
End Function
5. Close the Form module and switch the form to Form view.
6. Click the Start Slide Show button to display the specified Microsoft
PowerPoint presentation in a separate window.
For more information about referencing object libraries, search on the phrase "referencing object libraries," and then view "setting references" using the Answer Wizard from the Microsoft Access for Windows 95 Help menu.
For more information about OLE Automation, search on the phrase "OLE automation," and then view "Using Microsoft Access as an OLE Controller" using the Answer Wizard from the Microsoft Access for Windows 95 Help menu.
Keywords : kbinterop kbole IntpOlea
Version : 7.0
Platform : WINDOWS
Hardware : x86
Issue type : kbhowto
Last Reviewed: August 29, 1997