in
dex
will be
set to whatever num ber you call
AddNextSlideButton
with (see “Pa rame-
ters” in Chapter 8 for more in formation about parameters).
Sub AddNextSlideButton(in
dex As Long)
Dim myShape As Shape
Set myShape = ActivePresentation.Slides(in
dex).Shapes. _
AddShape(msoShapeActionButtonForwardorNext, _
612#, 456#, 82.12, 82.12)
With myShape.ActionSettings(ppMouseClick)
.Ac
tion = ppActionNextSlide
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoTrue
End With
With myShape
.Fill.ForeColor.SchemeColor = ppAccent1
.Fill.Vis
ible = msoTrue
.Fill.Solid
.Line.ForeColor.RGB = RGB(255, 255, 255)
.Line.Vis
ible = msoTrue
End With
End Sub
In this pro cedure, the
Set
line creates the but ton and sets
myShape
to point
to it.
msoShapeActionButtonForwardorNext
cre ates it as a but ton with a
for ward-point ing ar row. The first
With
block sets the ac tion (this is what makes
it go to the next slide) with the line
.Action = ppActionNextSlide
. The
other lines in the first
With
block aren’t re ally necessary but complete the ac tion
features of the button.
The second
With
block sets colors (specifically
Fill
and
Line
col ors). If
you are us ing the default color scheme, this en tire
With
block is un necessary,
but you can play with the pa rameters to see how the but tons that are created
change.
The last thing you should note about this pro cedure is that it was created us -
ing a macro. You can do some things by creating macros by go ing to the Tools
menu and choos ing “Record Macro.” What ever you do will be placed into a
VBA pro cedure. This is very good for setting up pa rameters, such as colors and
shapes and locations. How ever, a macro created in Edit View will not run prop -
erly in Slide Show View. Therefore, use the macro to guide you in creating
shapes and picking col ors, but put those pa rameters into your own code that will
run in Slide Show View. This requires un derstanding some complicated con -
cepts, so don’t worry if you don’t get it right away.
182 Tem plates
Do'stlaringiz bilan baham: |