Option Explicit
Private ppApp As PowerPoint.Application
Sub updatePPfiles()
Dim ppPath As String, ppList() As Variant
Dim i As Integer
'note: ppApp declared outside sub
Dim ppPresentation As PowerPoint.Presentation
Dim ppSlides As PowerPoint.Slides
Dim ppSlide As PowerPoint.Slide
Dim slideShapes As PowerPoint.Shapes
Dim ShapeReference As PowerPoint.Shape
Dim ppShape As PowerPoint.Shape
Dim sh1 As Worksheet
Set sh1 = ThisWorkbook.Worksheets("Sheet1")
'set powerpoint application object once
If ppApp Is Nothing Then Set ppApp = New PowerPoint.Application
With sh1
ppPath = .Range("B1") 'cell B1 holds the path to the folder with powerpoint
ppList = .Range("A4:D" & .Range("A4").End(xlDown).Row) 'list -> array
End With
'update slides
For i = 1 To UBound(ppList, 1)
Set ppPresentation = ppApp.Presentations.Open( _
ppPath & ppList(i, 1) & ".pptx", WithWindow:=msoFalse)
Set ppSlides = ppPresentation.Slides
'title and text to 2nd slide
Set ppSlide = ppSlides(2)
Set slideShapes = ppSlide.Shapes
slideShapes(1).TextFrame.TextRange.Text = ppList(i, 2)
slideShapes(2).TextFrame.TextRange.Text = ppList(i, 3)
'pic to 3rd slide
Set ppSlide = ppSlides(3)
Set slideShapes = ppSlide.Shapes
Set ShapeReference = slideShapes(1) 'picture to anchor to
With ShapeReference
Set ppShape = slideShapes.AddPicture(ppPath & ppList(i, 4), msoFalse, msoCTrue, _
.Left, .Top, .Width, .Height)
End With
ShapeReference.Delete
ppPresentation.Save
ppPresentation.Close
Next i
End Sub