From: lizsantiago on
I am a teacher trying to make a game using 2007, and i am trying to do two
things. One is to add an animation like the spin to a picture by clicking on
a botton, but all the examples i find , add the animations while creating a
shape so i dont know how to make the animation to an existing picture in my
slide. the other thing is to stop the animation by clicking on a button. I
found an example to pause the slide but the problem is that i have other
animations that are stopped as well and i cant use that. The picture is of a
wheel with numbers that i want to spin so when i click the stop it stops on a
different number of the wheel. for the spin i used the animation set to
..01 speed until slide ends and used the pause botton to stop it and that
works great to make it stop in a random number but as i said it stops the
textboxes that should appear with the questions for the students. any aideas
on how to use a code to do what i want. i have bought 3 books and read a
thousand sites, posted in every forum i have found but no one care to answer.
this is my last resort.
From: John Wilson john AT technologytrish.co DOT on
Set the repeat until next click.
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html






"lizsantiago" wrote:

> I am a teacher trying to make a game using 2007, and i am trying to do two
> things. One is to add an animation like the spin to a picture by clicking on
> a botton, but all the examples i find , add the animations while creating a
> shape so i dont know how to make the animation to an existing picture in my
> slide. the other thing is to stop the animation by clicking on a button. I
> found an example to pause the slide but the problem is that i have other
> animations that are stopped as well and i cant use that. The picture is of a
> wheel with numbers that i want to spin so when i click the stop it stops on a
> different number of the wheel. for the spin i used the animation set to
> .01 speed until slide ends and used the pause botton to stop it and that
> works great to make it stop in a random number but as i said it stops the
> textboxes that should appear with the questions for the students. any aideas
> on how to use a code to do what i want. i have bought 3 books and read a
> thousand sites, posted in every forum i have found but no one care to answer.
> this is my last resort.
From: David Marcovitz on
On 4/1/10 9:01 PM, lizsantiago wrote:
> I am a teacher trying to make a game using 2007, and i am trying to do two
> things. One is to add an animation like the spin to a picture by clicking on
> a botton, but all the examples i find , add the animations while creating a
> shape so i dont know how to make the animation to an existing picture in my
> slide. the other thing is to stop the animation by clicking on a button. I
> found an example to pause the slide but the problem is that i have other
> animations that are stopped as well and i cant use that. The picture is of a
> wheel with numbers that i want to spin so when i click the stop it stops on a
> different number of the wheel. for the spin i used the animation set to
> .01 speed until slide ends and used the pause botton to stop it and that
> works great to make it stop in a random number but as i said it stops the
> textboxes that should appear with the questions for the students. any aideas
> on how to use a code to do what i want. i have bought 3 books and read a
> thousand sites, posted in every forum i have found but no one care to answer.
> this is my last resort.

If you want to set an animation to an existing shape, you have to
identify the shape. This can be done by shape name or number (names tend
to be more stable). For example,

ActivePresentation.Slides(3).Shapes(5)

is a pointer to the 5th shape on slide 3. If you name that shape, then
you could use the name. For example if you named it My Pretty Shape, you
could get to the shape with:

ActivePresentation.Slides(3).Shapes("My Pretty Shape")

Whatever code you have that does something to a slide that is being
added should then work with this. If you post a snippet, we can help you
get it to work properly.

--David

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
From: liz santiago on
Thanks David, I know how to name the object that i am using since i bought your book, which by the way have made me get interested in vba, my real problem is that i dont know how to assign to a shape one of the effects like spin or fade or something like that. For now i am using this
Sub RndSpin(oShp as Shape)
Dim t As Single
t = Timer + (Rnd * 4) + 1
Do Until Timer > t
oShp.Rotation = oShp.Rotation + 5
DoEvents
Loop
End Sub

but the spinning is too slow, though it has the exact effect that i need because it lands in a random position of the wheel.





---
frmsrcurl: http://msgroups.net/microsoft.public.powerpoint/Please-Heeeeelp-Vba-code-to-add-animation-to-an-existing-object
From: David Marcovitz on
Great. I'm glad you are learning from the book. Assigning animation with
VBA is a bit tricky and then using VBA to activate it is trickier still.
As I was looking for a link to Shyam's site with explanation of this, I
came across this post by him:

> You can assign an animation in PPT
> 2002 and later using the following code:
> Sub CreateAnimation()
> Dim oEffect As Effect
> Dim oShpA As Shape
> With ActivePresentation.Slides(1)
> 'Create two autoshapes on the slide.
> Set oShpA = .Shapes.AddShape(msoShapeRectangle, 100, 100, 50, 50)
> ' Assign an animation to shape A
> Set oEffect = .TimeLine.MainSequence.AddEffect(Shape:=oShpA,
> effectId:=msoAnimEffectAppear)
> End With
> End Sub
>
>
> To assign an interactive animation take a look at the code here:
> http://skp.mvps.org/pptxp012.htm#interactive
>
> You can turn off the animations on the slides but this applies to the
> presentation as a whole and not specific slides. Look at the
> slideshowsetting - ShowWithAnimation property to address this.
>
> To determine the animation status you need to setup an event hook to track
> the animations as they fire. Look on my site for a downloadable example of
> eventhandler in PowerPoint http://skp.mvps.org/download.htm
>
>
> --
> Regards,
> Shyam Pillai


In this example, you already have the shape so you don't need to create
the shapes or assign it to oShpA. You can skip that part of the code and
just use the oShp that you already have.

--David

On 4/2/10 12:00 PM, liz santiago wrote:
> Thanks David, I know how to name the object that i am using since i bought your book, which by the way have made me get interested in vba, my real problem is that i dont know how to assign to a shape one of the effects like spin or fade or something like that. For now i am using this
> Sub RndSpin(oShp as Shape)
> Dim t As Single
> t = Timer + (Rnd * 4) + 1
> Do Until Timer> t
> oShp.Rotation = oShp.Rotation + 5
> DoEvents
> Loop
> End Sub
>
> but the spinning is too slow, though it has the exact effect that i need because it lands in a random position of the wheel.
>
>
>
>
>
> ---
> frmsrcurl: http://msgroups.net/microsoft.public.powerpoint/Please-Heeeeelp-Vba-code-to-add-animation-to-an-existing-object


--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland