• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2519
  • Last Modified:

Open and run a powerpoint presentation in Access form

I have a pre-existing powerpoint presentation with inserted video clips.  I am wanting to display the powerpoint in an access form.  The code that I am using does all that perfectly.  However, the embedded video clips don't play in the access form.  Any ideas on how to modify this code to make that work as well.

Option Explicit
Option Compare Database

' Initialize variables.
Private mcolSlideIDs As Collection
Private mlngSlideIndex As Long

Private Sub insertShow_Click()
    On Error GoTo insertShow_Click_Error
   
    ' Open PowerPoint
    Dim strPowerPointFile As String
    Dim pptobj As PowerPoint.Application
    Set pptobj = New PowerPoint.Application
    pptobj.Visible = True
    pptobj.WindowState = ppWindowMinimized
   
    strPowerPointFile = "C:\Users\Brian R Will MD\Desktop\Patient Power Point\Patient Education.ppt"
   
    ' Fill a collection with all Slide IDs.
    With pptobj.Presentations.Open(strPowerPointFile)
        Set mcolSlideIDs = New Collection
        Dim ppSlide As PowerPoint.Slide
        For Each ppSlide In .Slides
            mcolSlideIDs.Add ppSlide.SlideID
        Next
        .Close
    End With
   
    ' Close PowerPoint
    pptobj.Quit
    Set pptobj = Nothing

    ' Make object frame visible and enable "navigation" buttons.
    pptFrame.Visible = True
    frstSlide.Enabled = True
    lastSlide.Enabled = True
    nextSlide.Enabled = True
    previousSlide.Enabled = True

    ' Specify OLE Class, Type, SourceDoc, SourceItem and other properties.
    With pptFrame
        .Class = "Microsoft Powerpoint Slide"
        .OLETypeAllowed = acOLELinked
        .SourceDoc = strPowerPointFile
    End With
    SetSlide 1
   
    frstSlide.SetFocus
    insertShow.Enabled = False
   
    Exit Sub

insertShow_Click_Error:
    MsgBox Err.Number & " " & Err.Description
    Exit Sub
End Sub

Private Sub SetSlide(ByVal ID As Integer)
    On Error GoTo ErrorHandler
   
    Select Case ID
    Case Is > mcolSlideIDs.Count
        MsgBox "This is the last slide."
    Case 0
        MsgBox "This is the first slide."
    Case Else
        mlngSlideIndex = ID
        With pptFrame
            .SourceItem = mcolSlideIDs(mlngSlideIndex)
            .Action = acOLECreateLink
        End With
    End Select

    Exit Sub
ErrorHandler:
    MsgBox Err.Number & " " & Err.Description
    Exit Sub
End Sub

Private Sub frstSlide_Click()
    SetSlide 1
End Sub
Private Sub lastSlide_Click()
    SetSlide mcolSlideIDs.Count
End Sub

Private Sub nextSlide_Click()
    SetSlide mlngSlideIndex + 1
End Sub

Private Sub previousSlide_Click()
    SetSlide mlngSlideIndex - 1
End Sub
0
isurgyn
Asked:
isurgyn
  • 5
  • 4
  • 2
  • +1
3 Solutions
 
Jeffrey CoachmanMIS LiasonCommented:
As far as I know, an OLE embedded file, can only be triggered to run from the "Parent" application.

In other words, the video will run in PP, if PP is opened on its own (not opened inside of Access).

If PP is run in (inside) of Access, then the video will only run at the MS Access application level.

I may be wrong, or this may be different in Office 2007, so let's wait for another Export to be sure.

Whats the need to run PP inside of MS Access?
0
 
GRayLCommented:
As far as I know, none of the normal Access form controls can play a video.  I believe you have to buy such a control, I was not able to find any that you could download and use for free.  This URL gives you a free limited period use of one that will play AVI files:

http://www.fmsinc.com/microsoftaccess/controls/components/video/avi-player.htm
0
 
isurgynAuthor Commented:
Thanks very much for the help.  It is mainly for convenience and an integrated look to display the Powerpoint presentation within the Access form.  I have the code to activate PowerPoint and run the presentation already but just didn't like having to close the PP and resume Access when I am through showing the PPT presentation.

The Access video control looks very interesting.  It would work to show the video clips but would be somewhat cumbersome as I need to display the PPT slides with text as well.  With the text slides and video slides intermixed it would be interesting to format the Access form to toggle back and forth between PPT frame and the ActiveX AVI frame, particularly if I want to show them a close to full screen size.  Also, the price tag on the add-in is enough that the inconvenience of closing PP is probably palatable.

Thanks again.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Richard DanekeTrainerCommented:
Please keep in mind that an action button in PowerPoint can be used to relaunch Access as well as a hyperlink.
Also, a hyperlink can be used to launch the powerpoint and, if it is a PowerPoint Show file, can open it in SlideShow format.  Bookmarks can help in opening to a specific slide, if needed.
0
 
Jeffrey CoachmanMIS LiasonCommented:
GRayL,

You can use the MS Media player active-x control to play a video in Access.

But I am not sure how it could be "inter-opped" to work from PP...

Jeff
untitled.JPG
0
 
GRayLCommented:
Jeff:  Thanks.  I just checked my installed References and there are a wack of Windows Media Player references also.  I've been in this forum for over 8 years and this is the first time I've seen a question where someone wanted to play a video clip in an Access form.  Truth be told this is not my cup of tea - over to you my friend.
0
 
Jeffrey CoachmanMIS LiasonCommented:
Yeah,

I only did this out of curiosity once for another Q.
It worked "OK" but not all WMP features were available, ...and for some reason the control would "shrink" slightly every time you clicked on it...
   ...eventually disappearing into oblivion...


0
 
isurgynAuthor Commented:
Great suggestions.  Sometimes the simplest is the easiest.  I changed the code to automate PowerPoint directly and open the presentation and then placed an Action button the triggers a macro in the ppt presentation as per DoDahD's advice.

However, I do like the idea of using the MS Media player and may use that on some pure video features of the database application.

The only issue I have so far with my current code is that it doesn't always seem to open the PowerPoint presentation in a maximized mode.  Any thoughts?

Private Sub cmdOpenPPT_Click()

    Dim ppt As Object
    Dim pptPres As PowerPoint.Presentation
   
    Set ppt = CreateObject("PowerPoint.Application")
    ppt.Visible = True
    ppt.Presentations.Open "C:\Users\Brian R Will MD\Desktop\Patient Power Point\Patient Education.ppt"
   
    ppt.ActivePresentation.SlideShowSettings.Run
   
    Set ppt = Nothing

End Sub


Action button code in PPT slides as follows:

Sub ClosePPT()

    SlideShowWindows(1).View.Exit
    Application.Quit

End Sub

0
 
Jeffrey CoachmanMIS LiasonCommented:
The PowerPoint "Application" will open in whatever state it was last in.
But since you set the powerpoint slideshow "file" itself to: .run
...it will open the slideshow full screen
So this should be OK

But if you want to maximize the PP application, try adding this:

    ppt.Visible = True
    ppt.WindowState = ppWindowMaximized


JeffCoachman


0
 
isurgynAuthor Commented:
Thanks for the all of your suggestions.  The PP application now loads and opens beautifully and closes with the action button.

I am building a rather unique application and greatly appreciate the help.  This is definitely the best forum, particularly for complicated issues.  

0
 
Jeffrey CoachmanMIS LiasonCommented:
Great
0
 
isurgynAuthor Commented:
I will work on the Windows Media Player to see if I can get that solution to work and will post back the code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now