You are currently offline, waiting for your internet to reconnect

How to create sample Visual Basic for Applications code that uses Automation to create a PowerPoint 2000 presentation in Access 2000

This article was previously published under Q209960
This article has been archived. It is offered "as is" and will no longer be updated.
Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies only to a Microsoft Access database (.mdb).

This article describes how to create sample Microsoft Visual Basic for Applicationscode that uses Automation to create a Microsoft PowerPoint 2000 presentation in Microsoft Access 2000.
  1. Start Access 2000. Open any database.
  2. Create the following new form not based on any table or query in Design view, with the control indicated:
    Form: PowerPointDemo
    Caption: PowerPoint Demo

    Command Button: cmdPowerPoint
    Name: cmdPowerPoint
    Caption: PowerPoint Example
    Width: 2"
  3. On the View menu, click Code.
  4. On the Tools menu, click References.
  5. In the Available References box, click Microsoft PowerPoint 9.0 Object Library and Microsoft Office 9.0 Object Library.
  6. Click OK to close the References dialog box.
  7. Type the following line in the Declarations section of the class module of the PowerPointDemo form:
    Dim ppObj As Object, ppPres As Object
  8. Type the following procedure:
    Private Sub cmdPowerPoint_Click()  Dim xloop As Integer  On Error Resume Next  Set ppObj = GetObject(, "PowerPoint.application")  If Err.Number Then     Set ppObj = CreateObject("PowerPoint.Application")     Err.Clear  End If  On Error GoTo err_cmdOLEPowerPoint  Set ppPres = ppObj.Presentations.Add  With ppPres     For xloop = 1 To 5        .Slides.Add xloop, ppLayoutTitle        .SlideMaster.Background.Fill.PresetTextured _           msoTextureOak        .Slides(xloop).Shapes(1).TextFrame.TextRange.Text = _           "Hi!  Page " & xloop        .Slides(xloop).SlideShowTransition.EntryEffect = ppEffectFade        Select Case xloop           Case 1              With .Slides(xloop).Shapes(2).TextFrame.TextRange                 .Text = "This is an Example of Automation."                 .Characters.Font.Color.RGB = RGB(255, 255, 255)                 .Characters.Font.Shadow = True              End With              .Slides(xloop).Shapes(1).TextFrame.TextRange. _                 Characters.Font.Size = 50           Case 2              With .Slides(xloop).Shapes(2).TextFrame.TextRange                 .Text = "The programs interact seamlessly..."                 .Characters.Font.Color.RGB = RGB(255, 0, 255)                 .Characters.Font.Size = 48                 .Characters.Font.Shadow = True              End With              .Slides(xloop).Shapes(1).TextFrame.TextRange. _                 Characters.Font.Size = 90           Case 3              With .Slides(xloop).Shapes(2).TextFrame.TextRange                 .Text = "Demonstrating the power..."                 .Characters.Font.Color.RGB = RGB(255, 0, 0)                 .Characters.Font.Size = 42                 .Characters.Font.Shadow = True              End With              .Slides(xloop).Shapes(1).TextFrame.TextRange. _                 Characters.Font.Size = 50           Case 4              With .Slides(xloop).Shapes(2).TextFrame.TextRange                 .Text = "Of interoperable applications..."                 .Characters.Font.Color.RGB = RGB(0, 0, 255)                 .Characters.Font.Size = 34                 .Characters.Font.Shadow = True              End With              .Slides(xloop).Shapes(1).TextFrame.TextRange. _                 Characters.Font.Size = 100           Case 5              With .Slides(xloop).Shapes(2).TextFrame.TextRange                 .Text = "Created on the Fly!!!!"                 .Characters.Font.Color.RGB = RGB(0, 255, 0)                 .Characters.Font.Size = 72                 .Characters.Font.Shadow = True              End With              .Slides(xloop).Shapes(1).TextFrame.TextRange. _                 Characters.Font.Size = 60        End Select     Next  End With  ppPres.SlideShowSettings.Run  Exit Sub  err_cmdOLEPowerPoint:  MsgBox Err.Number & " " & Err.DescriptionEnd Sub					
  9. Save the PowerPointDemo form and open it in Form view.
  10. Click PowerPoint Example.

    Notice that the PowerPoint 2000 slide show is created and then appears on your screen.
For additional information about using Automation with Microsoft PowerPoint, click the article number below to view the article in the Microsoft Knowledge Base:
210075 ACC2000: How to Display Microsoft PowerPoint Slides on a Form

Article ID: 209960 - Last Review: 01/11/2015 02:05:12 - Revision: 2.2

Microsoft Access 2000 Standard Edition, Microsoft PowerPoint 2000 Standard Edition

  • kbnosurvey kbarchive kbhowto kbinterop KB209960