I'm new here, so please forgive any transgressions. I am writing some code which will copy a picture shape on a slide, move the copy to a new place on the slide and add some animations to the new picture which are triggered interactively by clicking on a shape. The code works great outside of slideshow mode, and it technically works inside slideshow mode too, but only after I restart the slideshow.
This is my problem. I want the animations to update and trigger inside the slideshow. Updating animations on the MainSequence timeline works just fine, but the interactive sequences timeline doesn't update inside the slideshow. Is there a workaround for this? Or is this just a "feature" of powerpoint?
Thanks. Code:
Sub CopyPicAddAnimation()
Dim sourcePic As Shape
Dim targetPic As Shape
Dim btnShp As Shape
Dim frame As Shape
Dim targetSlide As Integer
Dim sourceSlide As Integer
Dim pastedShapes As ShapeRange
Dim seqInteractive As Sequence
Dim effSwivelAppear As Effect
Dim effSwivelDisapper As Effect
Dim effAppear As Effect
Dim effDisappear As Effect
targetSlide = 2
sourceSlide = 2
Set sourcePic = ActivePresentation.Slides(sourceSlide).Shapes("img1")
Set frame = ActivePresentation.Slides(targetSlide).Shapes("frame1")
Set btnShp = ActivePresentation.Slides(targetSlide).Shapes("btn1")
sourcePic.Copy
Set pastedShapes = ActivePresentation.Slides(targetSlide).Shapes.Paste
Set targetPic = pastedShapes(1)
targetPic.Name = "NewPic"
targetPic.LockAspectRatio = msoFalse
targetPic.Width = frame.Width
targetPic.Height = frame.Height
targetPic.Top = frame.Top
targetPic.Left = frame.Left
Set seqInteractive = ActivePresentation.Slides(targetSlide).TimeLine. _
InteractiveSequences.Add()
Set effSwivelAppear = seqInteractive.AddEffect(Shape:=targetPic, _
effectId:=msoAnimEffectSwivel, trigger:=msoAnimTriggerOnShapeClick)
With effSwivelAppear.Timing
.Duration = 1.5
.TriggerShape = btnShp
End With
End Sub
Oh, Some workarounds I have already tried include advancing and returning to the slide in the slideshow manually, and having the slideshow redirect itself to the slide with new animations again using VBA code. Moving around the slideshow doesn't seem to help the animations on the slide refresh.
The button shape that I designated for the shape to trigger the animation remains completely un-clickable in the slideshow.
It is frustrating that the MainTimeline can update in the slideshow just fine, but the interactive timeline seems to no update at all until the slideshow is exited and started up again.