O seguinte funcionou para mim. Primeiro, instale o suplemento AutoEvents . No exemplo abaixo, uma apresentação contínua em PowerPoint de dois slides é usada (se você tiver mais, altere a instrução if na terceira macro para o número do último slide). Crie três subs, que façam o mesmo:
- Sub Auto_ShowBegin ()
- Sub Auto_Open ()
- Sub OnSlideShowPageChange (ByVal SSW como SlideShowWindow)
Auto_ShowBegin () e Auto_Open () são os mesmos.
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
E a terceira 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