In PowerPoint VBA, I'm trying to use the Animation Painter to copy the animation from one picture to the other pictures on a slide. My code successfully turns on the Animation Painter and it successfully selects the next picture, but I can't actually get the paste to work. If I pause execution right after the Animation painter is turned on then I can manually select the next the picture and the animation is successfully copied. So how do I force the paste? Here is the code:
Sub animaPainter()
Dim osh As Shape
Dim nameSelect As String
nameSelect = ActiveWindow.Selection.ShapeRange.Name
For Each osh In ActiveWindow.Selection.SlideRange.Shapes
With osh
If osh.Name = nameSelect Then GoTo LoopEnd
If .Type = msoLinkedPicture _
Or .Type = msoPicture _
Then
togglePainter
osh.Select msoTrue
osh.Apply
End If
End With
LoopEnd:
Next
End Sub
Private Sub togglePainter()
Dim localApp As PowerPoint.Application
Set localApp = GetObject(Class:="PowerPoint.Application")
localApp.CommandBars.ExecuteMso ("AnimationPainter")
End Sub
Sub animaPainter()
Dim osh As Shape
Dim nameSelect As String
nameSelect = ActiveWindow.Selection.Sha
ActiveWindow.Selection.Sha
For Each osh In ActiveWindow.Selection.Sli
With osh
If osh.Name = nameSelect Then GoTo LoopEnd
If .Type = msoLinkedPicture _
Or .Type = msoPicture _
Then
osh.ApplyAnimation
End If
End With
LoopEnd:
Next
End Sub