code not working - why?

G

Geoff Cox

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
 
D

David M. Marcovitz

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


--
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/
 
G

Geoff Cox

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

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
 
D

David M. Marcovitz

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

--
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/
 
G

Geoff Cox

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
 
G

Geoff Cox

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

David

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

Cheers,

Geoff
 
D

David M. Marcovitz

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

--
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/
 
G

Geoff Cox

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
 
G

Geoff Cox

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

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
 
D

David M. Marcovitz

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


--
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/
 
G

Geoff Cox

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

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

Cheers

Geoff
 

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

Similar Threads


Top