[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Open and run a powerpoint presentation in Access form

Posted on 2011-05-04
12
Medium Priority
?
2,295 Views
Last Modified: 2012-05-11
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
Comment
Question by:isurgyn
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35691879
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
 
LVL 44

Expert Comment

by:GRayL
ID: 35691978
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
 

Author Comment

by:isurgyn
ID: 35692352
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Accepted Solution

by:
Richard Daneke earned 500 total points
ID: 35692776
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35693462
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
 
LVL 44

Expert Comment

by:GRayL
ID: 35693695
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35693760
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
 

Author Comment

by:isurgyn
ID: 35695280
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
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 500 total points
ID: 35695425
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
 

Assisted Solution

by:isurgyn
isurgyn earned 0 total points
ID: 35695494
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35695575
Great
0
 

Author Closing Comment

by:isurgyn
ID: 35718563
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

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question