How to add Sound in Powerpoint Programatically??

G

Guest

I m into powerpoint automation. I m animating few shapes simultaneously using
Timeline for powerpoint 2002. But i have problems adding sound effects to the
animations. I have two shapes: rectangle and text. Both of them get animated
together. But when I try to add sound they come one after another. Can
someone help me in adding soundeffect without effecting the simultaneous
animations of rectangle and the text?
i am pasting the little bit of code if any one can help me out in this matter?
Sub ApplyEffect2002Effects(NewShape As Object, TextProperty As
TextProperty_, Optional EffectName As String = ""
------------------------------------------------------------------------------------
Here is the Module which defines EffectSlide<slidenumber> functions
---------------------------------
Option Explicit

Sub EffectsTextFade(effect_ As Object)

On Error Resume Next

With effect_
.EffectInformation.Dim.schemecolor = 8
.Timing.TriggerType = 2
.Timing.TriggerDelayTime = 0
.Timing.Speed = 5
.EffectType = 56 'Const msoAnimEffectChangeFontColor = 56

End With

End Sub


Sub EffectsRectangleFade(effect_ As Object)

On Error Resume Next

With effect_
.EffectInformation.Dim.schemecolor = 8
.Timing.TriggerType = 2
.Timing.TriggerDelayTime = 0
.Timing.Speed = 5
.EffectType = 10
.Exit = msoTrue
End With

End Sub


'Stretch Across: Slide1
Sub EffectsSlide1(effect_ As Object, Index As Long, Optional ForText As Long
= 1)

On Error Resume Next

With effect_
.Timing.TriggerType = IIf(InStr(effect_.Shape.Name, "Text"), 1, 2)
.Timing.TriggerDelayTime = 0
.EffectType = 17
.EffectParameters.Direction = 18
End With

End Sub

'Strips DownLeft Slide 2
Sub EffectsSlide2(effect_ As Object, Index As Long, Optional ForText As Long
= 1)
On Error Resume Next
With effect_

.Timing.TriggerType = IIf(InStr(effect_.Shape.Name, "Text"), 1, 2)
.Timing.TriggerDelayTime = 0
.EffectType = 18
.EffectParamters.Direction = 9

End With

End Sub

'Stretch fromBottom Slide 3
Sub EffectsSlide3(effect_ As Object, Index As Long, Optional ForText As Long
= 1)
On Error Resume Next
With effect_

.Timing.TriggerType = IIf(InStr(effect_.Shape.Name, "Text"), 1, 2)
.Timing.TriggerDelayTime = 0
.EffectType = 17
.EffectParameters.Direction = 11

End With

End Sub

'Stretch from top Slide 3A
Sub EffectsSlide4(effect_ As Object, Index As Long, Optional ForText As Long
= 1)
On Error Resume Next

With effect_
'.Timing.TriggerType = 2
.Timing.TriggerType = IIf(InStr(effect_.Shape.Name, "Text"), 1, 2)
.Timing.TriggerDelayTime = 0
.EffectType = 17
.EffectParameters.Direction = 10
End With

End Sub

'Rect: Fly from left & Text: Fade - Slide 4
Sub EffectsSlide5(effect_ As Object, Index As Long, Optional ForText As Long
= 1)
On Error Resume Next

With effect_
.Timing.TriggerType = IIf(InStr(effect_.Shape.Name, "Text"), 1, 2)
.Timing.TriggerDelayTime = 0
.EffectType = IIf(InStr(effect_.Shape.Name, "Text"), 10, 2)
.EffectParameters.Direction = IIf(InStr(effect_.Shape.Name, "Text"),
0, 4)
' If ForText Then
' .Timing.TriggerType = 1
' .Timing.TriggerDelayTime = 0
' .EffectType = 10
' Else
' .Timing.TriggerType = 2
' .Timing.TriggerDelayTime = 0
' .EffectType = 2
' .EffectParameters.Direction = 4
' End If

End With

End Sub

Dim effect_ As Object
If EffectName = "" Then
EffectName = gAnimationStyleName
End If

With TextProperty.ParentSlide.TimeLine
Set effect_ = .MainSequence.AddEffect(Shape:=NewShape, effectId:=0)

Select Case EffectName

Case "EffectsRectangleFade"
EffectsRectangleFade effect_

Case "EffectsTextFade"
EffectsTextFade effect_

Case "Style1"
EffectsSlide1 effect_, gAnimationOrderCounter

Case "Style2"
EffectsSlide2 effect_, gAnimationOrderCounter

Case "Style3"
EffectsSlide3 effect_, gAnimationOrderCounter

Case "Style4"
EffectsSlide4 effect_, gAnimationOrderCounter
End Select
End With

i want to put and then applies the effects using
Timline ANimations (We use timeline in 2002& above becoz Animationsettings
work for 2000 & earlier). Now we need to add sound to every effect.
Currently i am workin in VB
Thanks.
 
S

Shyam Pillai

Your code posting seems incomplete to me. So I cannot suggest anything to
fix it. One thing you should be wary about is that Timeline in PPT 2002/2003
has a bug in the object model. If you attempt to set any media properties it
will knock off all the non-entrance animation assigned to the shapes on that
slide.

--
Regards,
Shyam Pillai

Animation Carbon: http://skp.mvps.org/ac/
 
G

Guest

Is there any method that we can add sounds to our presentation without
effecting our Animation Order.I want to add for office 2000 above.. So can
any one tell me how to add the sound to the PPT 2002/2003.If Any one has Any
info abt this plz FWd it to me ASAP.
Thanks
 

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