The following worked for me. First, install the add-in AutoEvents. In the example below, a continuous PowerPoint presentation of 2 slides is used (if you have more, change the if statement in the third macro to the number of your last slide). Create three subs, that do the same:
- Sub Auto_ShowBegin()
- Sub Auto_Open()
- Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
Auto_ShowBegin() and Auto_Open() are the same.
Sub Auto_ShowBegin()
Dim sldTemp As Slide
Dim lngTemp As Long
Dim lngCount As Long
Dim myImage As Shape
For Each sldTemp In ActivePresentation.Slides
For lngCount = sldTemp.Shapes.Count To 1 Step -1
With sldTemp.Shapes(lngCount)
If .Type = msoPicture Then
.Delete
End If
End With
Next
Next
Set sldTemp = ActivePresentation.Slides(1)
Set myImage = sldTemp.Shapes.AddPicture( _
FileName:="C:\Users\Name\image1.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=(ActivePresentation.PageSetup.SlideWidth / 2), _
Top:=(ActivePresentation.PageSetup.SlideHeight / 2))
myImage.Left = (ActivePresentation.PageSetup.SlideWidth / 2) - (myImage.Width / 2)
myImage.Top = (ActivePresentation.PageSetup.SlideHeight / 2) - (myImage.Height / 2)
Set sldTemp = ActivePresentation.Slides(2)
Set myImage = sldTemp.Shapes.AddPicture( _
FileName:="C:\Users\Name\image2.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=(ActivePresentation.PageSetup.SlideWidth / 2), _
Top:=(ActivePresentation.PageSetup.SlideHeight / 2))
myImage.Left = (ActivePresentation.PageSetup.SlideWidth / 2) - (myImage.Width / 2)
myImage.Top = (ActivePresentation.PageSetup.SlideHeight / 2) - (myImage.Height / 2)
End Sub
And the third macro:
Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
Dim sldTemp As Slide
Dim lngTemp As Long
Dim lngCount As Long
Dim myImage As Shape
' AUTO UPDATE OF OLE LINKS MACRO
'
If SSW.View.CurrentShowPosition = 2 Then
For Each sldTemp In ActivePresentation.Slides
For lngCount = sldTemp.Shapes.Count To 1 Step -1
With sldTemp.Shapes(lngCount)
If .Type = msoPicture Then
.Delete
End If
End With
Next
Next
Set sldTemp = ActivePresentation.Slides(1)
Set myImage = sldTemp.Shapes.AddPicture( _
FileName:="C:\Users\Name\image1.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=(ActivePresentation.PageSetup.SlideWidth / 2), _
Top:=(ActivePresentation.PageSetup.SlideHeight / 2))
myImage.Left = (ActivePresentation.PageSetup.SlideWidth / 2) - (myImage.Width / 2)
myImage.Top = (ActivePresentation.PageSetup.SlideHeight / 2) - (myImage.Height / 2)
Set sldTemp = ActivePresentation.Slides(2)
Set myImage = sldTemp.Shapes.AddPicture( _
FileName:="C:\Users\Name\image2.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=(ActivePresentation.PageSetup.SlideWidth / 2), _
Top:=(ActivePresentation.PageSetup.SlideHeight / 2))
myImage.Left = (ActivePresentation.PageSetup.SlideWidth / 2) - (myImage.Width / 2)
myImage.Top = (ActivePresentation.PageSetup.SlideHeight / 2) - (myImage.Height / 2)
End If
End Sub
It sounds like there is a better way than PowerPoint to do what you are trying to do. – Nattgew – 2014-06-04T17:17:32.547
@fooot Do you have a suggestion for a program or application? – Robin Trietsch – 2014-06-04T17:23:54.783