Refresh PowerPoint 2010 Embedded Graphs from Access 2010 VB

Posted on 2012-08-23
Last Modified: 2012-08-26
I am trying to update a set of PowerPoint 2010 (FabMetrics.pptx) slides that have an embedded Excel 2010 graphs (FabMetrics.xlsx). I am keepping the source formatting & linking the data.

I am using Access 2010 (FabMetrics.accdb) VB to update the excel spreadsheet. Is it possible to use VB to refresh all of the PowerPoint slides after Access exports the new data to excel?

Also, the PowerPoint will be running as a slide show.  Do I need to close or stop the show to do the refresh?
Question by:Scamquist
    LVL 6

    Accepted Solution

    You can iterate through the slides, then shapes on slides, then charts in shapes.  You can use the refresh method in the chart to refresh the data.  You will need to have the reference to PowerPoint established in your Access DB.

    Function RefreshCharts()
    Dim ppApp As PowerPoint.Application, ppPres As PowerPoint.Presentation
    Dim ppSlide As PowerPoint.Slide, ppShape As PowerPoint.Shape
    Dim sFilePath As String

    sFilePath = [Enter Your Path] & "FabMetrics.pptx"
    Set ppApp = New PowerPoint.Application
    ppApp.Visible = True
    Set ppPres = ppApp.Presentations.Open(sFilePath)

    For Each ppSlide In ppPres.Slides
        For Each ppShape In ppSlide.Shapes
            If ppShape.HasChart Then
            End If
        Next ppShape
    Next ppSlide


    Set ppShape = Nothing
    Set ppSlide = Nothing
    Set ppPres = Nothing
    Set ppApp = Nothing

    End Function
    LVL 1

    Author Comment

    When I run the function, I get the error

    Run-time error '-2147467259 (80004005)':

    Presentation (unknown member): The presentation is read-only and must be saved with a different name.

    The hang comes at

    I have a running display on in my factory.  Does the slideshow need to stop during the refresh?
    LVL 6

    Expert Comment

    You can not refresh the PowerPoint from Access and save the results when the presentation is open.  It is erroring because it is opening a second version and because the first is already open, it defaults to read-only.

    The only other solution is to write the code within PowerPoint and push that code to refresh within the application.
    LVL 6

    Expert Comment

    Or, if you need this as a contstant item, it could be ran continuously through the access application and run directly on your displaying machine.
    LVL 1

    Author Closing Comment

    Thank you for your help.  I think I will have access stop PowerPoint, Refresh and open it up again.  Your code will help.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
    This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
    The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now