Problem with VBA and AnimationSettings - esp. ChartUnitEffect

S

Sean

Can anyone help.

I am trying to use VBA to automate a custom animation.

The code below doesn't work and I don't know why.


For Each objShape In objSlide.Shapes
With objShape.AnimationSettings
.Animate = msoTrue
.ChartUnitEffect = ppAnimateBySeries
.AnimateBackground = msoTrue
End With
Next

VBA complains about ChartUnitEffect, saying

AnimationSettings (unknown member) Invalid Request: Sorry, you can't
set chart effects on objects that are not charts.

The object it's complaining about is a chart, and I can set the same
custom animation manually without any problem.

I can also record a macro of the manual operation, and it records fine,
but the macro then doesn't work when I run it and produces the same
error as above.


Hope someone knows the answer.
 
G

Guest

It looks like you are looking at each shape on a slide in turn. Some are
probably not charts hence the complaint.

Try adding a check for charts something like :
For Each objShape In objSlide.Shapes
With objShape.AnimationSettings
If objshape.Type = msoChart Then
.Animate = msoTrue
.ChartUnitEffect = ppAnimateBySeries
.AnimateBackground = msoTrue End if
End With
Next


--

Did that answer the question / help?
_____________________________
John Wilson
Microsoft Certified Office Specialist
http://www.technologytrish.co.uk/ppttipshome.html
 
G

Guest

This may work better!

If objshape.Type = 7 Then
With objshape.AnimationSettings

..Animate = msoTrue
..ChartUnitEffect = ppAnimateBySeries
..AnimateBackground = msoTrue

End With
End If
--

Did that answer the question / help?
_____________________________
John Wilson
Microsoft Certified Office Specialist
http://www.technologytrish.co.uk/ppttipshome.html
 
S

Steve Rindsberg

John Wilson said:
It looks like you are looking at each shape on a slide in turn. Some are
probably not charts hence the complaint.

Try adding a check for charts something like :
For Each objShape In objSlide.Shapes
If objshape.Type = msoChart Then

That probably won't fly but:

If objShape.Type = 7 Then ' embedded ole object
If objShape.OLEFormat.ProgID = "MSGraph.Chart.8" Then
' etc

should do it. I think you only see msoChart objects in Access.
 

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