title: PowerPoint/VBA: How to replace placeholder with image when slide loads
body: <p>I trying to make PowerPoint load up images to replace placeholders everytime a slide changes. 
  I have the code working, which changes the placeholders with images from local drive or url. But it wont work on <code>OnSlideShowPageChange()</code> event(mentioned <a href="https://stackoverflow.com/questions/3203961/call-subroutine-when-a-specific-slide-loads-or-on-a-timer">here</a>). With no prior experience on VB/VBA, I have no idea why, as it does not give any errors. I know the event is accessed because if I put a <code>MsgBox()</code>-function in it, it is displayed.</p>
  
  <p>ImageReplace code:</p>
  
  <pre><code>Dim strPicName As String
  Dim shp As Shape
  Dim sglShapeLeft As Single
  Dim sglShapeTop As Single
  Dim sglShapeHeight As Single
  Dim sglShapeWidth As Single
  
  'Get the name of the shape (image)
  'Provided this is the only shape on the slide
  'Since I don't think you can use the ME. keyword to reference an impage from Powerpoint VBA
  '(Me.shape.Name)
  For Each shp In ActiveWindow.Selection.SlideRange.Shapes
      strPicName = shp.Name
  Next shp
  
  'Select the Image
  ActiveWindow.Selection.SlideRange.Shapes(strPicName).Select
  'Get the Left and Top starting points and width and height
  sglShapeLeft = ActiveWindow.Selection.SlideRange.Shapes(strPicName).Left
  sglShapeTop = ActiveWindow.Selection.SlideRange.Shapes(strPicName).Top
  sglShapeHeight = ActiveWindow.Selection.SlideRange.Shapes(strPicName).Height
  sglShapeWidth = ActiveWindow.Selection.SlideRange.Shapes(strPicName).Width
  'Delete the Image
  ActiveWindow.Selection.ShapeRange.Delete
  'Insert a new Image at the same starting points as the previous image
  ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="&lt;picturePath/url&gt;", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=sglShapeLeft, Top:=sglShapeTop, Width:=sglShapeWidth, Height:=sglShapeHeight).Select
  
  For Each shp In ActiveWindow.Selection.SlideRange.Shapes
      strPicName = shp.Name
  Next shp
  
  ActiveWindow.Selection.SlideRange.Shapes(strPicName).IncrementRotation 276#
  </code></pre>
  
  <p>Any help is appreciated</p>