I have the Powerpoint macro to open the excel file that the chart is in, but I need a Powerpoint macro to select "Refresh Data" in Powerpoint, but do not know how to write the macro to do this. I am using Powerpoint 2010. Any help will be much appreciated.

Dan

Suchit shah replied to Dan on 05-Dec-11 01:55 PM

Sub update_xl()

Dim oPres As Object
Dim oSld As Slide
Set oPres = ActivePresentation

With oPres
For Each oSld In .Slides
Call xlupdate(oSld)
Next oSld

End With

End Sub
Sub xlupdate(oSlideOrMaster As Object)
Dim oShp As PowerPoint.Shape

For Each oShp In oSlideOrMaster.Shapes
Dim oxl As Excel.Workbook
Dim xlsheet As Excel.Worksheet
If oShp.Type = msoEmbeddedOLEObject Then
Set oxl = oShp.OLEFormat.Object
Set xlsheet = oxl.Worksheets(1)
xlsheet.Cells(1, 1) = 20
End If

Set xlsheet = Nothing
Set xchart = Nothing
Set oxl = Nothing

Next oShp

End Sub

Dan replied to Suchit shah on 05-Dec-11 03:54 PM

Does not work. I do not want to update the Excel. That is already taken care of. I just want a macro to "Refresh Data" in the Powerpoint presentation, and not have to do it manually.

First, I do not want to change the text? I think I should mention that I want to refresh data will not running the slide show. I just open the powerpoint file and instead of selecting each slide and manually selecting "Refresh Data" I am try to come up with a macro that I can run that will goto each slide and "Refresh Data" automatically.