vba and animations

Hi,

I am using VBA in PowerPoint 2003.
I'm new to VBA and I find that looking for informations about animation is 
quite difficult. When I want to know what informations to give when I want to 
insert a shape, it's quite easy because I can record a macro and then use 
this information. Unfortunately, it's not possible for animation. Do you know 
of any good tutorial about this ? For example, I would like to know how to 
lenghten the path if I'm using msoAnimEffectPathRight or how to include a 
sound with it.

On another subject, there is still no answer to my question here and I 
haven't found an answer by myself :

http://www.microsoft.com/office/community/en-us/default.mspx?pg=3&cat=&lang=en&cr=US&guid=&sloc=en-us&dg=microsoft.public.powerpoint&fltr=

Thank you for your help. It is very appreciated.

Christine./
Exemple of code I am using, exploring userform and animations :

Private Sub CheckBox1_Click()
    etoile = True
End Sub

Private Sub CheckBox2_Click()
    carre = True
End Sub

Private Sub CheckBox3_Click()
    cercle = True
End Sub

Private Sub CommandButton1_Click()
    Me.hide
    If etoile = True Then
        Set formeEtoile = 
ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShape5pointStar, 67.75, 60.12, 97.38, 84.75)
        With formeEtoile
        .Fill.ForeColor.RGB = RGB(255, 255, 0)
        .Line.Weight = 4#
        .Line.ForeColor.RGB = RGB(255, 102, 0)
        .Line.BackColor.RGB = RGB(255, 255, 255)
    End With
    End If
    If carre = True Then
        Set formeCarre = 
ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShapeRectangle, 67.75, 191.38, 88.88, 78)
        With formeCarre
        .Fill.ForeColor.SchemeColor = ppAccent2
        .Fill.Transparency = 0#
        .Line.Weight = 4#
        .Line.ForeColor.RGB = RGB(128, 128, 128)
        .Line.BackColor.RGB = RGB(255, 255, 255)
    End With
    End If
    If cercle = True Then
        Set formeCercle = 
ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShapeOval, 
67.75, 401.5, 122.75, 122.75)
        With formeCercle
        .Fill.ForeColor.RGB = RGB(255, 0, 255)
        .Line.Weight = 4#
        .Line.ForeColor.RGB = RGB(153, 204, 0)
        .Line.BackColor.RGB = RGB(255, 255, 255)
    End With
    End If
    If etoile = True And trajet = True Then
        With 
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeEtoile, effectid:=msoAnimEffectPathRight)
            .Timing.SmoothEnd = False
            .Timing.SmoothStart = False
            .Timing.Speed = 1
            .Timing.TriggerType = msoAnimTriggerAfterPrevious
            .Timing.TriggerDelayTime = 1
        End With
    End If
    If etoile = True And emphase = True Then
        With 
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeEtoile, effectid:=msoAnimEffectSpin)
            .Timing.Duration = 2
            .Timing.TriggerType = msoAnimTriggerAfterPrevious
            .Timing.TriggerDelayTime = 1
        End With
    End If
    If carre = True And trajet = True Then
        With 
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCarre, effectid:=msoAnimEffectPathRight)
            .Timing.SmoothEnd = False
            .Timing.SmoothStart = False
            .Timing.Speed = 1
            .Timing.TriggerType = msoAnimTriggerAfterPrevious
            .Timing.TriggerDelayTime = 1
        End With
    End If
    If carre = True And emphase = True Then
        With 
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCarre, effectid:=msoAnimEffectFlicker)
            .Timing.Duration = 2
            .Timing.TriggerType = msoAnimTriggerAfterPrevious
            .Timing.TriggerDelayTime = 1
        End With
    End If
    If cercle = True And trajet = True Then
        With 
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCercle, effectid:=msoAnimEffectPathRight)
            .Timing.SmoothEnd = False
            .Timing.SmoothStart = False
            .Timing.Speed = 1
            .Timing.TriggerType = msoAnimTriggerAfterPrevious
            .Timing.TriggerDelayTime = 1
        End With
    End If
    If cercle = True And emphase = True Then
        With 
ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCercle, effectid:=msoAnimEffectWave)
            .Timing.Duration = 2
            .Timing.TriggerType = msoAnimTriggerAfterPrevious
            .Timing.TriggerDelayTime = 1
        End With
    End If
End Sub

Private Sub OptionButton1_Click()
    trajet = True
End Sub

Private Sub OptionButton2_Click()
    emphase = True
End Sub



0
Utf
6/4/2010 4:14:11 PM
powerpoint 2011 articles. 0 followers. Follow

2 Replies
7761 Views

Similar Articles

[PageSpeed] 21

Unfortunately, there is not much available on this topic. I think the 
most you are going to find is on Shyam's site:

http://skp.mvps.org/ppttimeline1.htm

I didn't discuss animations in my book about PowerPoint and VBA.

--David

-- 
David M. Marcovitz
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/


On 6/4/10 12:14 PM, Christine Fournier wrote:
> Hi,
>
> I am using VBA in PowerPoint 2003.
> I'm new to VBA and I find that looking for informations about animation is
> quite difficult. When I want to know what informations to give when I want to
> insert a shape, it's quite easy because I can record a macro and then use
> this information. Unfortunately, it's not possible for animation. Do you know
> of any good tutorial about this ? For example, I would like to know how to
> lenghten the path if I'm using msoAnimEffectPathRight or how to include a
> sound with it.
>
> On another subject, there is still no answer to my question here and I
> haven't found an answer by myself :
>
> http://www.microsoft.com/office/community/en-us/default.mspx?pg=3&cat=&lang=en&cr=US&guid=&sloc=en-us&dg=microsoft.public.powerpoint&fltr=
>
> Thank you for your help. It is very appreciated.
>
> Christine./
> Exemple of code I am using, exploring userform and animations :
>
> Private Sub CheckBox1_Click()
>      etoile = True
> End Sub
>
> Private Sub CheckBox2_Click()
>      carre = True
> End Sub
>
> Private Sub CheckBox3_Click()
>      cercle = True
> End Sub
>
> Private Sub CommandButton1_Click()
>      Me.hide
>      If etoile = True Then
>          Set formeEtoile =
> ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShape5pointStar, 67.75, 60.12, 97.38, 84.75)
>          With formeEtoile
>          .Fill.ForeColor.RGB = RGB(255, 255, 0)
>          .Line.Weight = 4#
>          .Line.ForeColor.RGB = RGB(255, 102, 0)
>          .Line.BackColor.RGB = RGB(255, 255, 255)
>      End With
>      End If
>      If carre = True Then
>          Set formeCarre =
> ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShapeRectangle, 67.75, 191.38, 88.88, 78)
>          With formeCarre
>          .Fill.ForeColor.SchemeColor = ppAccent2
>          .Fill.Transparency = 0#
>          .Line.Weight = 4#
>          .Line.ForeColor.RGB = RGB(128, 128, 128)
>          .Line.BackColor.RGB = RGB(255, 255, 255)
>      End With
>      End If
>      If cercle = True Then
>          Set formeCercle =
> ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShapeOval,
> 67.75, 401.5, 122.75, 122.75)
>          With formeCercle
>          .Fill.ForeColor.RGB = RGB(255, 0, 255)
>          .Line.Weight = 4#
>          .Line.ForeColor.RGB = RGB(153, 204, 0)
>          .Line.BackColor.RGB = RGB(255, 255, 255)
>      End With
>      End If
>      If etoile = True And trajet = True Then
>          With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeEtoile, effectid:=msoAnimEffectPathRight)
>              .Timing.SmoothEnd = False
>              .Timing.SmoothStart = False
>              .Timing.Speed = 1
>              .Timing.TriggerType = msoAnimTriggerAfterPrevious
>              .Timing.TriggerDelayTime = 1
>          End With
>      End If
>      If etoile = True And emphase = True Then
>          With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeEtoile, effectid:=msoAnimEffectSpin)
>              .Timing.Duration = 2
>              .Timing.TriggerType = msoAnimTriggerAfterPrevious
>              .Timing.TriggerDelayTime = 1
>          End With
>      End If
>      If carre = True And trajet = True Then
>          With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCarre, effectid:=msoAnimEffectPathRight)
>              .Timing.SmoothEnd = False
>              .Timing.SmoothStart = False
>              .Timing.Speed = 1
>              .Timing.TriggerType = msoAnimTriggerAfterPrevious
>              .Timing.TriggerDelayTime = 1
>          End With
>      End If
>      If carre = True And emphase = True Then
>          With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCarre, effectid:=msoAnimEffectFlicker)
>              .Timing.Duration = 2
>              .Timing.TriggerType = msoAnimTriggerAfterPrevious
>              .Timing.TriggerDelayTime = 1
>          End With
>      End If
>      If cercle = True And trajet = True Then
>          With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCercle, effectid:=msoAnimEffectPathRight)
>              .Timing.SmoothEnd = False
>              .Timing.SmoothStart = False
>              .Timing.Speed = 1
>              .Timing.TriggerType = msoAnimTriggerAfterPrevious
>              .Timing.TriggerDelayTime = 1
>          End With
>      End If
>      If cercle = True And emphase = True Then
>          With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCercle, effectid:=msoAnimEffectWave)
>              .Timing.Duration = 2
>              .Timing.TriggerType = msoAnimTriggerAfterPrevious
>              .Timing.TriggerDelayTime = 1
>          End With
>      End If
> End Sub
>
> Private Sub OptionButton1_Click()
>      trajet = True
> End Sub
>
> Private Sub OptionButton2_Click()
>      emphase = True
> End Sub
>
>
>

-1
David
6/4/2010 6:08:58 PM
Christine,
You can change the length of the motion path animation by editing the VML 
information of the motion. Take a look at the string returned by the Path 
property and parse the information from there.
You can read more about VML. Basically the motion string is a set of space 
delimited coordinates representing lines or bezier curves. The dimensions 
are relative to the size of the slide.

Sub AddMotionPath()

   Dim shpNew As Shape
   Dim effNew As Effect
   Dim aniMotion As AnimationBehavior

   Set shpNew = ActivePresentation.Slides(1).Shapes _
       .AddShape(Type:=msoShape5pointStar, Left:=0, _
       Top:=0, Width:=100, Height:=100)
   Set effNew = ActivePresentation.Slides(1).TimeLine.MainSequence _
       .AddEffect(Shape:=shpNew, effectId:=msoAnimEffectCustom, _
       Trigger:=msoAnimTriggerWithPrevious)
   Set aniMotion = effNew.Behaviors.Add(msoAnimTypeMotion)

   With aniMotion.MotionEffect
      .Path = "M 0 0  L -0.25 0  E"
   End With

End Sub

Regards,
Shyam Pillai

Image Importer Wizard
http://skp.mvps.org/iiw.htm


> Hi there,


Regards,
Shyam Pillai

Animation Carbon
http://www.animationcarbon.com


"Christine Fournier" <ChristineFournier@discussions.microsoft.com> wrote in 
message news:BDFBC628-FA5A-40A6-9167-F3A42BF3AF5D@microsoft.com...
> Hi,
>
> I am using VBA in PowerPoint 2003.
> I'm new to VBA and I find that looking for informations about animation is
> quite difficult. When I want to know what informations to give when I want 
> to
> insert a shape, it's quite easy because I can record a macro and then use
> this information. Unfortunately, it's not possible for animation. Do you 
> know
> of any good tutorial about this ? For example, I would like to know how to
> lenghten the path if I'm using msoAnimEffectPathRight or how to include a
> sound with it.
>
> On another subject, there is still no answer to my question here and I
> haven't found an answer by myself :
>
> http://www.microsoft.com/office/community/en-us/default.mspx?pg=3&cat=&lang=en&cr=US&guid=&sloc=en-us&dg=microsoft.public.powerpoint&fltr=
>
> Thank you for your help. It is very appreciated.
>
> Christine./
> Exemple of code I am using, exploring userform and animations :
>
> Private Sub CheckBox1_Click()
>    etoile = True
> End Sub
>
> Private Sub CheckBox2_Click()
>    carre = True
> End Sub
>
> Private Sub CheckBox3_Click()
>    cercle = True
> End Sub
>
> Private Sub CommandButton1_Click()
>    Me.hide
>    If etoile = True Then
>        Set formeEtoile =
> ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShape5pointStar, 
> 67.75, 60.12, 97.38, 84.75)
>        With formeEtoile
>        .Fill.ForeColor.RGB = RGB(255, 255, 0)
>        .Line.Weight = 4#
>        .Line.ForeColor.RGB = RGB(255, 102, 0)
>        .Line.BackColor.RGB = RGB(255, 255, 255)
>    End With
>    End If
>    If carre = True Then
>        Set formeCarre =
> ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShapeRectangle, 
> 67.75, 191.38, 88.88, 78)
>        With formeCarre
>        .Fill.ForeColor.SchemeColor = ppAccent2
>        .Fill.Transparency = 0#
>        .Line.Weight = 4#
>        .Line.ForeColor.RGB = RGB(128, 128, 128)
>        .Line.BackColor.RGB = RGB(255, 255, 255)
>    End With
>    End If
>    If cercle = True Then
>        Set formeCercle =
> ActivePresentation.SlideShowWindow.View.Slide.Shapes.AddShape(msoShapeOval,
> 67.75, 401.5, 122.75, 122.75)
>        With formeCercle
>        .Fill.ForeColor.RGB = RGB(255, 0, 255)
>        .Line.Weight = 4#
>        .Line.ForeColor.RGB = RGB(153, 204, 0)
>        .Line.BackColor.RGB = RGB(255, 255, 255)
>    End With
>    End If
>    If etoile = True And trajet = True Then
>        With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeEtoile, 
> effectid:=msoAnimEffectPathRight)
>            .Timing.SmoothEnd = False
>            .Timing.SmoothStart = False
>            .Timing.Speed = 1
>            .Timing.TriggerType = msoAnimTriggerAfterPrevious
>            .Timing.TriggerDelayTime = 1
>        End With
>    End If
>    If etoile = True And emphase = True Then
>        With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeEtoile, 
> effectid:=msoAnimEffectSpin)
>            .Timing.Duration = 2
>            .Timing.TriggerType = msoAnimTriggerAfterPrevious
>            .Timing.TriggerDelayTime = 1
>        End With
>    End If
>    If carre = True And trajet = True Then
>        With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCarre, 
> effectid:=msoAnimEffectPathRight)
>            .Timing.SmoothEnd = False
>            .Timing.SmoothStart = False
>            .Timing.Speed = 1
>            .Timing.TriggerType = msoAnimTriggerAfterPrevious
>            .Timing.TriggerDelayTime = 1
>        End With
>    End If
>    If carre = True And emphase = True Then
>        With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCarre, 
> effectid:=msoAnimEffectFlicker)
>            .Timing.Duration = 2
>            .Timing.TriggerType = msoAnimTriggerAfterPrevious
>            .Timing.TriggerDelayTime = 1
>        End With
>    End If
>    If cercle = True And trajet = True Then
>        With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCercle, 
> effectid:=msoAnimEffectPathRight)
>            .Timing.SmoothEnd = False
>            .Timing.SmoothStart = False
>            .Timing.Speed = 1
>            .Timing.TriggerType = msoAnimTriggerAfterPrevious
>            .Timing.TriggerDelayTime = 1
>        End With
>    End If
>    If cercle = True And emphase = True Then
>        With
> ActivePresentation.SlideShowWindow.View.Slide.TimeLine.MainSequence.AddEffect(Shape:=formeCercle, 
> effectid:=msoAnimEffectWave)
>            .Timing.Duration = 2
>            .Timing.TriggerType = msoAnimTriggerAfterPrevious
>            .Timing.TriggerDelayTime = 1
>        End With
>    End If
> End Sub
>
> Private Sub OptionButton1_Click()
>    trajet = True
> End Sub
>
> Private Sub OptionButton2_Click()
>    emphase = True
> End Sub
>
>
> 
0
Shyam
6/5/2010 5:56:54 PM
Reply:

Similar Artilces: