0
votes

I have an excel file which composed of data and on a separate sheet, i create a graphs(bar, line, and doughnut). I used paste special from my created graphs in excel into my powerpoint so that it will be linked. Can someone tell me what will be the syntax to update those other slides?Thanks

This is my code and it is working only on the first slide of my presentation.

Sub Refresh(ParamArray var() As Variant)

Dim pApp As Object
Dim pPreso As Object
Dim pSlide As Object
Dim sPreso As String



    sPreso = "/Users/USER/Desktop/company/Presentation1.pptx"

        On Error Resume Next
            Set pApp = GetObject(, "PowerPoint.Application")
                If Err.Number <> 0 Then
                    Set pApp = CreateObject("PowerPoint.Application")
                    pApp.Visible = True
                End If

        On Error Resume Next
            Set pPreso = pApp.Presentations(sPreso)
                If Err.Number <> 0 Then
                    Set pPreso = pApp.Presentations.Open(Filename:=sPreso)
                End If

Dim varSize As Integer
Dim i As Integer


    varSize = UBound(var) - LBound(var) + 1

    For i = 0 To (varSize - 1)
        pPreso.Slides(1).Shapes(var(i)).LinkFormat.Update
    Next i

End Sub

When I close the application for both excel and ppt, and then reopen it again, when I try to edit on my excel file,only the first slide in the ppt is automatically updated, I want to update all the slides in my powerpoint presentation.

1

1 Answers

0
votes

I think You should run through all slides, maybe like this:

Dim sld
For Each sld In pPreso.Slides
    For i = 0 To (varSize - 1)
        sld.Shapes(Var(i)).LinkFormat.Update
    Next i
Next sld