Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / October 2006

Tip: Looking for answers? Try searching our database.

VBA removes other animation?!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Geoff Cox - 07 Oct 2006 09:47 GMT
Hello,

I have used the sub below to add a Sound Effect to an EndShow action
button (type 132).

This works fine - problem is that on the slide with the Action Button
all other animation is removed!

The animation is the type where words are moved across the slide when
the enter key is pressed.

Anyone see why this happens?

Thanks

Geoff

Sub add_sound (strMyFile As String)

Dim oPresentation As Presentation
Set oPresentation = Presentations.Open(strMyFile)
With oPresentation
Dim oSl As Slide

For Each oSl In ActivePresentation.Slides
ActiveWindow.View.GotoSlide (oSl.SlideIndex)
Dim oSh As shape
Dim oHl As Hyperlink

For Each oSh In oSl.Shapes
 If oSh.Type = 1 Then
   If oSh.AutoShapeType = 132 Then
    If oSh.TextFrame.TextRange.Text <> "Classroom notes" Then
       oSh.AnimationSettings.SoundEffect.Name = "Hammer"
     End If
   End If
End If
       
Next oSh
Next oSl
   
oPresentation.Save
oPresentation.Close

End With

Set oSh = Nothing
Set oPresentation = Nothing

End Sub
Shyam Pillai - 07 Oct 2006 17:01 GMT
This is a known bug. You should not use the older AnimationSettings when
coding in the newer versions (PPT2002 or later). Changing media animation
settings using the older object model in the new version will kill the
assigned animations. Use the new Timeline object instead.

Regards,
Shyam Pillai

Animation Carbon
http://animationcarbon.com

> Hello,
>
[quoted text clipped - 46 lines]
>
> End Sub
Geoff Cox - 07 Oct 2006 20:04 GMT
>This is a known bug. You should not use the older AnimationSettings when
>coding in the newer versions (PPT2002 or later). Changing media animation
>settings using the older object model in the new version will kill the
>assigned animations. Use the new Timeline object instead.

Shyam,

How do I use the Timeline object? It applies to a slide and not to a
shape? I'm confused!

oSh.AnimationSettings.SoundEffect.Name = "Hammer"

The above line is wrong - but how do I apply the Timeline object?

Geoff

For Each oSh In oSl.Shapes
 If oSh.Type = 1 Then
   If oSh.AutoShapeType = 132 Then
    If oSh.TextFrame.TextRange.Text <> "Classroom notes" Then

       oSh.AnimationSettings.SoundEffect.Name = "Hammer"

     End If
   End If
End If

>Regards,
>Shyam Pillai
[quoted text clipped - 52 lines]
>>
>> End Sub
Geoff Cox - 07 Oct 2006 23:05 GMT
>This is a known bug. You should not use the older AnimationSettings when
>coding in the newer versions (PPT2002 or later). Changing media animation
>settings using the older object model in the new version will kill the
>assigned animations. Use the new Timeline object instead.

Shyam,

My aim is to add the Hammer sound effect to the already existing
EndShow button without deleting the other animation settings on that
slide, but cannot see how to do that using the Timeline object.

Fumbling my way forward the following code places an EndShow action
button on the slide which already has an EndShow action button on it
(with the idea of eventually deleting the current button and replacing
it with the new one which will have the sound effect) using the
Timeline object but I guess I need some parameters after Shape:=shpnew
on the line,

With sldNew.TimeLine.MainSequence.AddEffect(Shape:=shpnew)

I would like to add the Hammer sound effect and an EndShow hyperlink
to this new EndShow action Button but have no idea how to do it?!
Help!

Cheers

Geoff

For Each oSh In oSl.Shapes
   If oSh.Type = 1 Then
       If oSh.AutoShapeType = 132 Then
       Set shpnew =
oSl.Shapes.AddShape(Type:=msoShapeActionButtonEnd, Left:=25, Top:=25,
Width:=100, Height:=100)
       With sldNew.TimeLine.MainSequence.AddEffect(Shape:=shpnew)

       End With

       End If
   End If
       
   Next oSh
   Next oSl
Shyam Pillai - 08 Oct 2006 14:44 GMT
Geoff,
Based on your additional info. I think it would be simpler to just add sound
to the existing action setting instead of try to assign an animation to it.

   With oSh.ActionSettings(ppMouseClick)
       .Action = ppActionEndShow
       .SoundEffect.ImportFromFile "C:\my sounds\hammer.wav"
   End With

Signature

Regards,
Shyam Pillai

Toolbox
http://skp.mvps.org/toolbox

>>This is a known bug. You should not use the older AnimationSettings when
>>coding in the newer versions (PPT2002 or later). Changing media animation
[quoted text clipped - 39 lines]
>    Next oSh
>    Next oSl
Geoff Cox - 08 Oct 2006 17:50 GMT
>Geoff,
>Based on your additional info. I think it would be simpler to just add sound
[quoted text clipped - 4 lines]
>        .SoundEffect.ImportFromFile "C:\my sounds\hammer.wav"
>    End With

Thanks for the idea Shyam - will give it a go.

Cheers

Geoff
Geoff Cox - 08 Oct 2006 18:10 GMT
>Geoff,
>Based on your additional info. I think it would be simpler to just add sound
[quoted text clipped - 4 lines]
>        .SoundEffect.ImportFromFile "C:\my sounds\hammer.wav"
>    End With
         

Shyam,

with the following code I am finding a type 132 (EndShow) button
and trying to add the sound to it - it's not working!?

Geoff

For Each oSh In oSl.Shapes
  If oSh.Type = 1 Then
    If oSh.AutoShapeType = 132 Then
        If oSh.TextFrame.TextRange.Text <> "Classroom notes" Then
               
               With oSh.ActionSettings(ppMouseClick)
               '.Hyperlink.Delete
               '.Action = ppActionEndShow
               .SoundEffect.ImportFromFile _
"C:\a-winfiles\hala\docs\power-point\sounds\online.wav"
         End With

     End If
           
 End If
               
End If
       
   Next oSh
   Next oSl
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.