title: How to automatically update PPT with Excel backend using VBA
body: <p>this is my first time posting here and I am fairly new to any kind of programming. I have developed a PPT dashboard and the Excel backend to support it. I wish to set it up so that when a user updates the Excel backend file, the charts I have copied to the PPT updates. The VBA module code I used is</p>
  <pre><code>Sub Refresh(ParamArray var() As Variant)
  Dim pApp As Object
  Dim pPreso As Object
  Dim pSlide As Object
  Dim sPreso As String
  'Define PowerPoint Dashboard File Path
  sPreso = &quot;C:\Users\name\OneDrive - company\Dasboard\Frontend&quot;
  'Open and reference PowerPoint Dashboard File
  On Error Resume Next
      Set pApp = GetObject(, &quot;PowerPoint.Application&quot;)
      
  If Err.Number &lt;&gt; 0 Then
      Set pApp = CreateObject(&quot;PowerPoint.Application&quot;)
      pApp.Visible = True
  End If
  On Error Resume Next
      Set pPreso = pApp.Presentations(sPreso)
      
  If Err.Number &lt;&gt; 0 Then
      Set pPreso = pApp.Presentations.Open(Filename:=sPreso)
  End If
      
  'Update every Chart in ParamArray Var
  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
  
  And the sheet module is 
  
  Sub Worksheet_Change(ByVal Target As Range)
      'Weekly Visits
      If Not Application.Intersect(Target, Range(&quot;C2:C3&quot;)) Is Nothing Then
          Call Refresh(&quot;Chart 34&quot;, &quot;Chart 37&quot;)
      End If
  End Sub
  </code></pre>
  <p>After refreshing the Excel backend, and updating an input for testing, nothing happened. Was there an issue with the code? does it have to do with the file path? Any help on this would be very appreciated.</p>