vba - how to adapt macro recorded code?

G

Geoff Cox

Hello,

I am trying to add a last slide which has an EndShow action button
covering the whole slide - to avoid the black screen etc.

This code adds a slide after the current last slide (the +1 bit is my
idea - there must be a better way to add after the last curretn
slide?!).

With oPresentation

Dim oSlide As Slide

Set oSlide = oPresentation.Slides.add(ActivePresentation
_.Slides.Count + 1, PowerPoint.PpSlideLayout.ppLayoutBlank)


End With

So far so good - but how do I add the EndShow button etc? The macro
recorder gives me the following but I do not understand how to apply
it to the above new slide. Help!

Cheers

Geoff

ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeActionButtonEnd,
0#, 0#, 720#, 540#).Select
With
ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick)
.Action = ppActionEndShow
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoTrue
End With
With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseOver)
.Action = ppActionNone
.SoundEffect.Type = ppSoundNone
.AnimateActi
 
D

David M. Marcovitz

Something like this should work:


Set oShp = ActivePresentation.Slides(ActivePresentation.Slides.Count) _
.Shapes.AddShape(msoShapeActionButtonEnd, 0#, 0#, 720#, 540#)
With oShp.ActionSettings(ppMouseClick)
.Action = ppActionEndShow
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoTrue
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

Set oShp = ActivePresentation.Slides(ActivePresentation.Slides.Count) _
.Shapes.AddShape(msoShapeActionButtonEnd, 0#, 0#, 720#, 540#)
With oShp.ActionSettings(ppMouseClick)
.Action = ppActionEndShow
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoTrue
End With

David,

Thanks - that works fine. I wonder if you know anything about the
removal of the black screen?

Your code works fine when using Package for CD onto the hard disk but
onto a CD and a mouse click is OK (you go to previous ppt file) but
pressing the enter key gives the black screen!

From a while back the MS answer seemed to be that you just have to
live with this. This still the case?

Cheers

Geoff
 
G

Geoff Cox

isn't it possible to trap the enter key somehow by adding a line above
so that the enter key has the same action as clicking the mouse?

Geoff
 
G

Geoff Cox

Something like this should work:


Set oShp = ActivePresentation.Slides(ActivePresentation.Slides.Count) _
.Shapes.AddShape(msoShapeActionButtonEnd, 0#, 0#, 720#, 540#)
With oShp.ActionSettings(ppMouseClick)
.Action = ppActionEndShow
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoTrue
End With

David,

Just realised that there is a problem! - I need to add the above
effect not to the last slide but to a new additional slide at the end
of the presentation ... your code overwrites my current last slide.

My code below with the +1 bit does this but do you see any possible
corrections/improvement to it?!

Geoff

Set oSl = oPresentation.Slides.Add(ActivePresentation.Slides.Count + _
1, PowerPoint.PpSlideLayout.ppLayoutBlank)

Set oSh2 = oSl.Shapes.AddShape(Type:=msoShapeActionButtonEnd, _
Left:=0, Top:=0, Width:=730, Height:=550)
oSh2.TextFrame.TextRange.Text = "Next"
oSh2.TextFrame.TextRange.Font.Size = 80
oSh2.ActionSettings(ppMouseClick).Action = ppActionEndShow
 
D

David M. Marcovitz

Geoff, my code was to add the button to the last slide. This was meant to
come after your code that added a new blank slide, so you just put my
code after yours, and it should work.

As far as the black slide issue goes, I believe that is a setting on each
individual computer (not each presentation) so if the computer has
PowerPoint settings to end on a black slide, then it will.

--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, my code was to add the button to the last slide. This was meant to
come after your code that added a new blank slide, so you just put my
code after yours, and it should work.

David,

OK - will check that again.
As far as the black slide issue goes, I believe that is a setting on each
individual computer (not each presentation) so if the computer has
PowerPoint settings to end on a black slide, then it will.

Yes, but I am concerned re those folk that do not have PPT on their
PC!

When using Package for CD onto the hard disk I would prefer to have
added only those facilities which will work when Package for CD is
used to prepare an actual CD!! Seems logical?!

Cheers

Geoff
 
G

Geoff Cox

If your presentation's in Kiosk mode and there's an End Show button on your own
last slide, they should never see the pseudo-pslide that MS pso rudely
inpserts.

Steve,

I think I am correct in thinking that kiosk mode means:

1. each slide must have a hyperlink to move to the next slide?

2. animation not possible using mouse click or enter key - must happen
using a time interval?

I guess this removes too much user control in that it is part of our
approach to get a student to work out an answer before having the
correct answers appear using the mouse or the enter key.

How much simpler to have a less rude end slide!

Cheers

Geoff
 
G

Geoff Cox

Hmm. Or via triggers.

Steve,

Re the trigger approach - I have tried the "start after previous" and
that will cause soem words to move into the "correct" places.

But, is it possible to use a trigger so that the words only start to
move when the user decides that they should?


Cheers

Geoff
 
D

David M. Marcovitz

Yes, that's what trigger animations are all about, but they only work in
2002 and above. You can find triggers under the Timing option of the
animation effects for a particular animation. It will allow a click to
cause the specified animation to happen only when a particular object is
clicked.
--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

Yes, that's what trigger animations are all about, but they only work in
2002 and above. You can find triggers under the Timing option of the
animation effects for a particular animation. It will allow a click to
cause the specified animation to happen only when a particular object is
clicked.
--David

David,

I have now got that working in that I have inserted a text box and
when this is successively clicked each word moves into its correct
place.

A couple of questions.

Is it possible to click just once and have a series of words move one
after the other?

I have added a forward/next action button to the slide master as an
easy way of getting that button onto each slide but I do not need that
button on the last page as there I should have an EndShow button. I
cannot seem to delete the forward/next button on the last slide - is
this possible?

If not I seem to have to add a forward/next button by hand to each
slide - or use VBA to add one to all slides except the last one ...

Cheers

Geoff
 
K

Kathy Jacobs

RE: Animating several objects off a singe trigger (with apologies if you
already got an answer...)
To do what you want, move the animations for the other boxes under the
triggered animations, then set them to work with previous or after previous.

--
Kathryn Jacobs, Microsoft MVP OneNote and PowerPoint
Author of Kathy Jacobs on PowerPoint - Available now from Holy Macro! Books
Get PowerPoint and OneNote information at www.onppt.com

I believe life is meant to be lived. But:
if we live without making a difference, it makes no difference that we lived
 
D

David M. Marcovitz

I think Steve and Kathy have answered your questions. If not, ask some
more. I was away giving a workshop about using VBA with PowerPoint so I
couldn't respond sooner.
--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

I think Steve and Kathy have answered your questions. If not, ask some
more. I was away giving a workshop about using VBA with PowerPoint so I
couldn't respond sooner.
--David

David, Steve and Kathy,

My apologies - I missed seeing these later posts - will have a try
tomorrow.

Thanks

Geoff
 
G

Geoff Cox

Not as such, but you can choose Format, Background and check Omit Background
Graphics.
That'll remove ALL of the b/g graphics, so next, go to the slide master, select
the stuff you DO want and copy/paste it onto your last slide, then send it to
the back.

Steve,

I obviously have not got this!

The endshow button is on the last slide. Carrying out the above
removes all the next buttons so do I cannot see how to get the next
buttons one each slide using the slide master and not have the next
button on the last slide.

I am lost on this!

Cheers

Geoff
 
G

Geoff Cox

Steve,

Ah! Apply background graphics removal to only the last slide! But slow
there!

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

Top