VBA Delay

A

Alexf

Hi All,

I'm having trouble coming up with a VBA code to complete this task, maybe
you guys can help:

I want to do this:
I have a slide with a billion objects with "After Previous" Animations.

I want to add an animation that runs for 30 seconds, but during that time,
the other objects set on "After Previous" are going to have to animate too.

My question is, is there a VBA code that you input a certain amount of
seconds (x), and it automatically makes each animation play x seconds after
each other, except that the objects don't have the "After Previous" property,
just the "with Previous" property.

Example:

I Run the script, it asks for how many seconds I want between all the
animations. I type in 0.4.

It automatically cancels out all "after Previous" and makes them "with
Previous." Then, it makes each animation 0.4 seconds apart. When this is
finished, the animations's "Start" dropdown box should still say "After
Previous, and every animation is 0.4 seconds apart.

Thanks guys, if you can understand what I mean.
 
J

John Wilson

This should get you started Alex. If the animation is "With previous" though
the Custom Animation pane will not sat "After Previous"

Sub delay_it()
Dim osld As Slide
Dim oeff As Effect
Dim strDelay As String
Dim Icount As Integer
Do
strDelay = InputBox("Delay")
Loop Until IsNumeric(strDelay)
Set osld = ActiveWindow.View.Slide
For Each oeff In osld.TimeLine.MainSequence
If oeff.Timing.TriggerType = msoAnimTriggerAfterPrevious Then
oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = CSng(strDelay) * (Icount)
Icount = Icount + 1
End If
Next oeff
End Sub
 
A

Alexf

For some reason, the delays don't move at all. Every animation is still
starting at zero.
 
J

John Wilson

Are you sure they were originally set to "After Previous"?

If not try without those lines

Sub delay_it()
Dim osld As Slide
Dim oeff As Effect
Dim strDelay As String
Dim Icount As Integer
Do
strDelay = InputBox("Delay")
Loop Until IsNumeric(strDelay)
Set osld = ActiveWindow.View.Slide
For Each oeff In osld.TimeLine.MainSequence

oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = CSng(strDelay) * (Icount)
Icount = Icount + 1

Next oeff
End Sub
--
john ATSIGN PPTAlchemy.co.uk
Custom vba coding and PPT Makeovers
Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
 
A

Alexf

Whoah! It works now!

Thanks again John!

John Wilson said:
Are you sure they were originally set to "After Previous"?

If not try without those lines

Sub delay_it()
Dim osld As Slide
Dim oeff As Effect
Dim strDelay As String
Dim Icount As Integer
Do
strDelay = InputBox("Delay")
Loop Until IsNumeric(strDelay)
Set osld = ActiveWindow.View.Slide
For Each oeff In osld.TimeLine.MainSequence

oeff.Timing.TriggerType = msoAnimTriggerWithPrevious
oeff.Timing.TriggerDelayTime = CSng(strDelay) * (Icount)
Icount = Icount + 1

Next oeff
End Sub
--
john ATSIGN PPTAlchemy.co.uk
Custom vba coding and PPT Makeovers
Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
 

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