vba and triggered action?

G

Geoff Cox

Hello,

I am trying to change to a kiosk mode and need to make the words which
currently appear (entrance/dissolve) when the enter key is pressed,
appear (triggered) when a shape is clicked on.

The code below finds the words (which are in text boxes) but I do not
have a clue as to how to make the appearance of each word be triggered
by clicking on a shape!

Pointers please!

Geoff

For Each oSl In ActivePresentation.Slides

ActiveWindow.View.GotoSlide (oSl.SlideIndex)

With oSl.TimeLine
For i = .MainSequence.Count To 1 Step -1
If .MainSequence(i).Shape.Type = msoTextBox Then
If .MainSequence(i).Shape _
.AnimationSettings.EntryEffect = _
ppEffectDissolve Then
End If
End If
Next i
End With

Next oSl
 
G

Geoff Cox

Hello,

I am trying to change to a kiosk mode and need to make the words which
currently appear (entrance/dissolve) when the enter key is pressed,
appear (triggered) when a shape is clicked on.

A little more code which may or may not be on the right path?!

But

1. how how do I allocate a value to <shapename> in the trigger
section?

2. do I have to delete the Dissolve and recreate it with the trigger
line?

Geoff

Dim oSl As Slide
Dim i As Long
Dim oSh As Shape
Dim oEffect As Effect
Dim oShB As Shape

With oPresentation

For Each oSl In ActivePresentation.Slides

ActiveWindow.View.GotoSlide (oSl.SlideIndex)

With oSl.TimeLine
For i = .MainSequence.Count To 1 Step -1
If .MainSequence(i).Shape.Type = msoTextBox Then
If .MainSequence(i).Shape.AnimationSettings _
.EntryEffect = ppEffectDissolve Then
Set oShB = oSl.Shapes.AddShape(msoShapeRectangle,
_500, 200, 100, 50)
Set oEffect = .InteractiveSequences.Add _
.AddEffect(Shape:= <shapename>,_
effectId:=ppEffectDissolve, _
trigger:=msoAnimTriggerOnShapeClick)

oEffect.Timing.TriggerShape = oShB
End If
End If
Next i
End With
Next oSl
 
G

Geoff Cox

On Tue, 24 Oct 2006 23:53:28 +0100, Geoff Cox

Still stuckl! I cannot see how to refer to the already exisiting shape
when it comes to the trigger line. Bellow I am using

set oSh = MainSequence(i)

and then oSh in the trigger line, but this is wrong. What should I do
here?

Thanks

Geoff


For Each oSl In ActivePresentation.Slides

ActiveWindow.View.GotoSlide (oSl.SlideIndex)

With oSl.TimeLine
For i = .MainSequence.Count To 1 Step -1
If .MainSequence(i).Shape.Type = msoTextBox Then
If .MainSequence(i).Shape.AnimationSettings _
.EntryEffect = ppEffectDissolve Then
Set oShB = oSl.Shapes.AddShape(msoShapeRectangle,
_500, 200, 100, 50)
set oSh = MainSequence(i)
Set oEffect = .InteractiveSequences.Add _
.AddEffect(Shape:= oSh,_
effectId:=ppEffectDissolve, _
trigger:=msoAnimTriggerOnShapeClick)

oEffect.Timing.TriggerShape = oShB
End If
End If
Next i
End With
Next oSl
 
D

David M. Marcovitz

set oSh = MainSequence(i)

What's that line supposed to do? MainSequence(i) is an effect, not a shape.
The line before it seems to set oShb to the shape of interest. Wouldn't you
want to add an effect for oShb to the interactive sequence? Also, when you
use an underscore at the end of a line, be sure that there is a space
before it.
--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

What's that line supposed to do? MainSequence(i) is an effect, not a shape.

David,

I knew this to wrong but as the msoTextBox with dissolve effect is
found by

With oSl.TimeLine
For i = .MainSequence.Count To 1 Step -1
If .MainSequence(i).Shape.Type = msoTextBox Then
If .MainSequence(i).Shape.AnimationSettings _
.EntryEffect = ppEffectDissolve Then
etc etc

some how I assume it is possible to set oSh (a shape object) to
something so that the oSh can be used in

Set oEffect = .InteractiveSequences.Add _
.AddEffect(Shape:= oSh, _
effectId:=ppEffectDissolve, _
trigger:=msoAnimTriggerOnShapeClick)

The line before it seems to set oShb to the shape of interest. Wouldn't you
want to add an effect for oShb to the interactive sequence?

the shape pShb is the shape which will be clicked.
Also, when you
use an underscore at the end of a line, be sure that there is a space
before it.

sorry about that - will be more careful.

I was probably asking the wrong question.

At its simplest there is a word which when the enter key is pressed
appears (entrance/dissolve) and fills a gap in a sentence.

Moving to kiosk mode I need that word to appear when a text box shape
is clicked with the mouse.

So, I am looking for code to create the shape to be clicked and then
the word with entrance/dissolve to be configured to move when
triggered by the clicking of the shape.

Am I making myself any clearer?!

Cheers

Geoff
 
D

David M. Marcovitz

Geoff,

I answered this one already. Once you have an Effect in the timeline, the
..Shape value of that Effect will give you the shape. Try:

set oSh = MainSequence(i).Shape

What you want to do is pretty clear, but you can't expect people in this
group to write all your code for you. We are all volunteers, and we
answer questions as best as we can. Sometimes, we get a spark and write a
lot of code for someone, but usually, we give pointers to people who are
trying to write their own code. Feel free to keep asking questions, but
if we don't have a ready-made solution to point you to, then we are
likely to answer your questions and let you create the code.

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

Geoff,

I answered this one already. Once you have an Effect in the timeline, the
.Shape value of that Effect will give you the shape. Try:
set oSh = MainSequence(i).Shape

David,

I am using that but get run time error message "Sequence (unknown
member): Invalid enumeration value", pointing at the line

Set oEffect = .InteractiveSequences.Add.AddEffect _
(Shape:=oSh, effectID:=ppEffectDissolve, _
trigger:=msoAnimTriggerOnShapeClick)

Have I got the order wrong?

There is another error I guess in that I am finding the msoTextBox
with the entrance/dissolve, deleting this and then re-creating this
effect which seems silly? This is present because I cannot find any
other way of getting the

msoAnimTriggerOnShapeClick

associated with the entrance/dissolve word.


With oSl.TimeLine
For i = .MainSequence.Count To 1 Step -1
If .MainSequence(i).Shape.Type = msoTextBox Then
If .MainSequence(i).Shape.AnimationSettings.EntryEffect _
= ppEffectDissolve Then
Set oSh = .MainSequence(i).Shape
.MainSequence(i).Delete
Set oShB = oSl.Shapes.AddShape(msoShapeRectangle, 500, 200, _
100, 50)
Set oEffect = .InteractiveSequences.Add.AddEffect _
(Shape:=oSh, effectID:=ppEffectDissolve, _
trigger:=msoAnimTriggerOnShapeClick)
oEffect.Timing.TriggerShape = oShB
End If
End If
Next i
End With
Next oSl

What you want to do is pretty clear, but you can't expect people in this
group to write all your code for you. We are all volunteers, and we

No of course - I do appreciate that. I am flailing around somethat
with this TimeLine object - I cannot find much code to look at apart
from the MS definitions and a few samples and no book with anything in
it, so I am really grateful for your help. I have always said that
news groups show the very best side of the Internet.

Cheers

Geoff
 
D

David M. Marcovitz

Unfortunately, everything I know about the timeline I have learned since
you started asking questions, and I don't have time to play with it
anymore right now. The only thing I can see right now is that your
AddEffect method is going to need to know what shape is animated and what
shape triggers the animation. You only tell it one of those things, so
somewhere, you're going to have to tell it the other one.
--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

Unfortunately, everything I know about the timeline I have learned since
you started asking questions, and I don't have time to play with it
anymore right now. The only thing I can see right now is that your
AddEffect method is going to need to know what shape is animated and what
shape triggers the animation. You only tell it one of those things, so
somewhere, you're going to have to tell it the other one.
--David

OK - thanks David.

Hope this catches Shyam's eye!

Cheers

Geoff
 
G

Geoff Cox

Unfortunately, everything I know about the timeline I have learned since
you started asking questions, and I don't have time to play with it
anymore right now. The only thing I can see right now is that your
AddEffect method is going to need to know what shape is animated and what
shape triggers the animation. You only tell it one of those things, so
somewhere, you're going to have to tell it the other one.
--David

David,

Just remembered that I have been trying to re-apply the coding in
Shyam's web site

http://skp.mvps.org/pptxp012.htm

Geoff

Sub CreateAnimationWithTrigger()
Dim oEffect As Effect
Dim oShpA As Shape
Dim oShpB As Shape
With ActivePresentation.Slides(1)
'Create two autoshapes on the slide.
Set oShpA = .Shapes.AddShape(msoShapeRectangle, 100, 100, _
50, 50)
Set oShpB = .Shapes.AddShape(msoShapeRectangle, 200, 100, _
50, 50)
' Assign an interactive animation to shape A
Set oEffect = .TimeLine.InteractiveSequences.Add _
.AddEffect(Shape:=oShpA, _
effectId:=msoAnimEffectPathCircle, _
trigger:=msoAnimTriggerOnShapeClick)
End With
' Define the triggering shape. If you omit this line then the _
animation will be _
' triggered by clicking on the shape A itself. _
oEffect.Timing.TriggerShape = oShpB
End Sub
 
G

Geoff Cox

David,

Just remembered that I have been trying to re-apply the coding in
Shyam's web site

http://skp.mvps.org/pptxp012.htm

the difference in my case being that the shape which will be animated,
his oShpA, already exists and is found by

For i = .MainSequence.Count To 1 Step -1
If .MainSequence(i).Shape.Type = msoTextBox Then
If .MainSequence(i).Shape.AnimationSettings.EntryEffect _
= ppEffectDissolve Then

Somehow I need to get this into following as oSh

Set oEffect = .InteractiveSequences.Add.AddEffect _
(Shape:=oSh, effectID:=ppEffectDissolve, _
trigger:=msoAnimTriggerOnShapeClick)

Cheers

Geoff
 
G

Geoff Cox

Unfortunately, everything I know about the timeline I have learned since
you started asking questions, and I don't have time to play with it
anymore right now. The only thing I can see right now is that your
AddEffect method is going to need to know what shape is animated and what
shape triggers the animation. You only tell it one of those things, so
somewhere, you're going to have to tell it the other one.
--David

David,

Blimey!!!!!!

The code below now works! I re-copied the

Set oEffect = .InteractiveSequences.Add _
.AddEffect(Shape:=oSh, effectId:=msoAnimEffectDissolve, _
trigger:=msoAnimTriggerOnShapeClick)


there must have been a typo somewhere!

Cheers

Geoff

With oSl.TimeLine
For i = .MainSequence.Count To 1 Step -1
If .MainSequence(i).Shape.Type = msoTextBox Then
If .MainSequence(i).Shape.AnimationSettings.EntryEffect _
= ppEffectDissolve Then
Set oSh = .MainSequence(i).Shape
.MainSequence(i).Delete
Set oShB = oSl.Shapes.AddShape(msoShapeRectangle, 500, 200, _
100, 50)
Set oEffect = .InteractiveSequences.Add _
.AddEffect(Shape:=oSh, effectId:=msoAnimEffectDissolve, _
trigger:=msoAnimTriggerOnShapeClick)
oEffect.Timing.TriggerShape = oShB
End If
End If
Next i
End With
Next oSl
 

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