Microsoft Powerpoint - Refresh Data - Asked By Dan on 05-Dec-11 09:49 AM

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.

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.
Riley K replied to Dan on 05-Dec-11 08:50 PM

Hope this helps

Sub refresh_me(oshp As Shape)
Dim osld As Slide
'get current slide
Set osld = SlideShowWindows(1).View.Slide
'change font colour in shape text
oshp.TextFrame.TextRange.Font.Color.RGB = vbRed
'the next line adds the empty textbox and refreshs the slide
osld.Shapes.AddTextbox msoTextOrientationHorizontal, 1, 1, 1, 1
End Sub

Refer this link

Suchit shah replied to Dan on 06-Dec-11 12:53 AM
Sub RefreshSlide()
Dim lSlideIndex As Long
lSlideIndex = SlideShowWindows(1).View.CurrentShowPosition
SlideShowWindows(1).View.GotoSlide lSlideIndex

End Sub
Dan replied to Suchit shah on 06-Dec-11 05:51 AM
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.