Open Power Point and Refresh Excel Charts

Richynero

Board Regular
Joined
Jan 16, 2012
Messages
150
Hi there,

I have a challenge where I have to loop through all PowerPoint files in a folder/subfolders and refresh the charts within them. These charts are shared on MS Teams and SharePoint and are not updating when the Excel files are amended. I have built the code to loop through the directory and open them but I am now struggling to get them to refresh. Apparently this code should work but this code will need to sit in every power point file (Update PowerPoint chart using VBA). Any ideas?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Richynero

Board Regular
Joined
Jan 16, 2012
Messages
150
Here is the code that runs within PowerPoint to refreh the charts. Thing is I dont want this sitting in each PowerPoint.

VBA Code:
Sub UpdateLinks()

    'Declare PowerPoint Variables
    Dim PPTSlide As Slide
    Dim PPTShape As Shape
    Dim SourceFile, FileName As String
    Dim Position As Integer

    'Declare Excel Variables
    Dim xlApp As Excel.Application
    Dim xlWorkBook As Excel.Workbook

   
    'Loop through each slide in the Presentation.
    For Each PPTSlide In ActivePresentation.Slides

        'Loop through Each Shape in the slide
        For Each PPTShape In PPTSlide.Shapes

            'If the Shape is a linked OLEObject.
            If PPTShape.Type = msoLinkedOLEObject Then

                    'Update the link
                    PPTShape.LinkFormat.Update

            End If

        Next PPTShape
    Next PPTSlide


End Sub
 

Forum statistics

Threads
1,136,200
Messages
5,674,379
Members
419,503
Latest member
tismail

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top