How to use the CommandEffect in custom animation?

M

Magnus

In the PowerPoint help they said “You can send events, call functions, and
send OLE verbs to embedded objects using this propertyâ€
Is it possible to create an animation in PowerPoint that call a VBA macro?
How should the code look?

I have tried this but it doesn’t work.

Sub CreateMacro()
Set currentShape = Application.ActivePresentation.Slides(1).Shapes(3)
Set effCustom =
Application.ActivePresentation.Slides(1).TimeLine.MainSequence.AddEffect(currentShape, msoAnimEffectCustom, msoAnimateLevelNone, msoAnimTriggerWithPrevious)
Set bhvEffect = effCustom.Behaviors.Add(msoAnimTypeCommand)
With bhvEffect.CommandEffect
.Type = msoAnimCommandTypeCall
.Command = "Test1"
End With
End Sub

Public Sub Test1()
ActivePresentation.Slides(1).Shapes(3).Fill.ForeColor.RGB = RGB(200, 100,
100)
End Sub

When I run my CreaeMacro function It appear a new animation in PowerPoint.
But when I run the slideshow the animation never call the Test1 macro.

Can any one complete this VBA-code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top