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.

code not working - why?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Geoff Cox - 23 Oct 2006 20:59 GMT
Hello,

Just in case my weekend posting slips out of site!

I am trying to remove the entrance/dissolve animation from some action
buttons - but the code below does not work. Ideas please!

Geoff

For Each oSh In oSl.Shapes
    If oSh.Type = 1 Then
        If oSh.AutoShapeType = 129 Then
            If oSh.AnimationSettings.EntryEffect = _
            ppEffectDissolve Then
            oSh.AnimationSettings.Animate = msoFalse
            End If
        End If
    End If
Next oSh
Next oSl

Cheers

Geoff
David M. Marcovitz - 23 Oct 2006 21:29 GMT
Correct me if I'm wrong, but I thought you were using the timeline and
would want something like this (I just have it doing slide 1, but you get
the idea):

Sub hmm()
   Dim i As Long
   With ActivePresentation.Slides(1).TimeLine
       For i = .MainSequence.Count To 1 Step -1
           If .MainSequence(i).EffectType = msoAnimEffectDissolve Then
               .MainSequence(i).Delete
           End If
       Next i
   End With
   
End Sub

Signature

David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

> Hello,
>
[quoted text clipped - 20 lines]
>
> Geoff
Geoff Cox - 23 Oct 2006 22:08 GMT
>Correct me if I'm wrong, but I thought you were using the timeline and
>would want something like this (I just have it doing slide 1, but you get
[quoted text clipped - 11 lines]
>    
>End Sub

David,

Thanks for going straight to using the TimeLine object - yes I should
and will use this approach - just out of curiosity what is wrong with
this other code?

For Each oSh In oSl.Shapes
    If oSh.Type = 1 Then
        If oSh.AutoShapeType = 129 Then
            If oSh.AnimationSettings.EntryEffect = _
            ppEffectDissolve Then
            oSh.AnimationSettings.Animate = msoFalse
            End If
        End If
    End If
Next oSh
Next oSl

Cheers

Geoff
David M. Marcovitz - 23 Oct 2006 22:17 GMT
I'm not sure because I don't do much coding with animations, but I think
it has to do with the timeline itself. With the timeline, you had one
animation per shape, and that was it. You could look at the EntryEffect,
and that would be it. With the timeline, each shape can have as many
animations as you want, so you can't just have one EntryEffect. As I
said, I could be wrong about this because I don't do it much.
--David

Signature

David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

>>Correct me if I'm wrong, but I thought you were using the timeline and
>>would want something like this (I just have it doing slide 1, but you
[quoted text clipped - 34 lines]
>
> Geoff
Geoff Cox - 23 Oct 2006 22:36 GMT
>I'm not sure because I don't do much coding with animations, but I think
>it has to do with the timeline itself. With the timeline, you had one
[quoted text clipped - 3 lines]
>said, I could be wrong about this because I don't do it much.
>--David

David

I guess you mean "before the timeline, you had one .."?

Cheers,

Geoff
Geoff Cox - 23 Oct 2006 22:33 GMT
>Correct me if I'm wrong, but I thought you were using the timeline and
>would want something like this (I just have it doing slide 1, but you get
>the idea):

David,

I have your code working in that it removes the dissolve animation
from those action buttons which already have it but I'm not sure how I
can target this at only type 129 action buttons (backwards/ previous)
and disreguard those which have which have the text "When finished" on
them.

I have used code below before but not at all clear how I work both
with the TimeLine and particular shapes. Can you help?!

Dim oSh As Shape
For Each oSh In oSl.Shapes
   If oSh.Type = 1 Then
       If oSh.AutoShapeType = 129 Then
           If oSh.TextFrame.TextRange.Text <> "When finished" Then

Thanks

Geoff

The code I am using based on your help is as follows,

Sub check_for_button(strMyFile As String)

   Dim oPresentation As Presentation
   Set oPresentation = Presentations.Open(strMyFile)
   Dim oSl As Slide
   Dim i As Long
   
   With oPresentation
     
   For Each oSl In ActivePresentation.Slides
 
   With oSl.TimeLine
       For i = .MainSequence.Count To 1 Step -1
           If .MainSequence(i).EffectType = msoAnimEffectDissolve _
    Then
               .MainSequence(i).Delete
           End If
       Next i
   End With
               
   Next oSl
 
   oPresentation.Save
   oPresentation.Close

   End With

   Set oSh = Nothing
   Set oPresentation = Nothing

End Sub
David M. Marcovitz - 23 Oct 2006 22:42 GMT
I belive that:

   ActivePresentation.Slides(1).TimeLine.MainSequence(1).Shape

will give you the shape of the first effect in the main timeline. That
is, if you have an effect that you are testing, you can also look at its
.Shape and the properties of its .Shape to test things about the shape
itself.

--David

Signature

David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

>>Correct me if I'm wrong, but I thought you were using the timeline and
>>would want something like this (I just have it doing slide 1, but you
[quoted text clipped - 54 lines]
>
> End Sub
Geoff Cox - 23 Oct 2006 23:59 GMT
> ActivePresentation.Slides(1).TimeLine.MainSequence(1).Shape

Thanks David - following seems to work.

       With oSl.TimeLine
       For i = .MainSequence.Count To 1 Step -1
           If .MainSequence(i).Shape.AutoShapeType = _
    msoShapeActionButtonBackorPrevious Then
           .MainSequence(i).Delete
           End If
       Next i
       End With

Cheers

Geoff
Geoff Cox - 24 Oct 2006 00:05 GMT
>Thanks David - following seems to work.
>
[quoted text clipped - 10 lines]
>
>Geoff

Actually this seems a bit odd (to me) in that there is no line

If .MainSequence(i).EffectType = msoAnimEffectDissolve Then

to test for the EffectType. I suppose the code simply finds any shape
of the type "msoShapeActionButtonBackorPrevious" and removes any
animation attached to it?

Geoff
David M. Marcovitz - 24 Oct 2006 15:09 GMT
Take a deep breath and think. You are right that you are not testing both
conditions so you need to test both conditions either using an AND
statement or nested IF statements. For example:

       With oSl.TimeLine
       For i = .MainSequence.Count To 1 Step -1
           If .MainSequence(i).Shape.AutoShapeType = _
              msoShapeActionButtonBackorPrevious _
                And .MainSequence(i).EffectType = _
                msoAnimEffectDissolve Then
           .MainSequence(i).Delete
           End If
       Next i
       End With

Signature

David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

>>Thanks David - following seems to work.
>>
[quoted text clipped - 20 lines]
>
> Geoff
Geoff Cox - 24 Oct 2006 18:41 GMT
>Take a deep breath and think. You are right that you are not testing both
>conditions so you need to test both conditions either using an AND
[quoted text clipped - 10 lines]
>        Next i
>        End With

Thanks David - now I just have to worry about TimeLine and triggers!

Cheers

Geoff
 
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.