ACC95: How to Run an MS PowerPoint 95 Slide Show in Access 95

Last reviewed: August 28, 1997
Article ID: Q147628
The information in this article applies to:
  • Microsoft Access version 7.0

SUMMARY

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.

MORE INFORMATION

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.

REFERENCES

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          : AutoGnrl kbinterop kbole IntpOleA
Technology        : kbole
Version           : 7.0
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.