×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

run PowerPoint macro on open

run PowerPoint macro on open

run PowerPoint macro on open

(OP)
Hi,

I've done a fair bit of research and it looks like there isn't a direct way to have a PP macro run when it is opened. When you add a PivotTable chart into a presentation from an exterior Excel document, it will live update if the Excel document PivotTable changes. Once you close the PowerPoint presentation, the link stops working even if you set it up in PowerPoint to automatically update. This is all done without VBA and just normal PP settings.

Since it doesn't update after the re-open, I found the following code that works. It will automatically re-connect the two files together and allow the pivot chart to update live again.

Is there a way with both files loaded to SharePoint or other method that can be used so the pivot chart is updated live in the PP file?

Also, if I embed a PivotTable, it won't update if the source in the Excel document updates. Is there a way to allow it to auto update the filters and sorts?

CODE

Sub test()

    Dim pptChart As Chart
    Dim pptChartData As ChartData
    Dim pptWorkbook As Object
    Dim sld As Slide
    Dim shp As Shape

    For Each sld In ActivePresentation.Slides
        For Each shp In sld.Shapes
            If shp.HasChart Then
                Set pptChart = shp.Chart
                Set pptChartData = pptChart.ChartData
                pptChartData.Activate
                shp.Chart.Refresh
            
                On Error Resume Next
                On Error GoTo 0

            End If
        Next
    Next

    Set pptWorkbook = Nothing
    Set pptChartData = Nothing
    Set pptChart = Nothing


End Sub 

Thanks for the help.

Mike

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close