Powerful PowerPoint for Educators: Using Visual Basic for Applications to Make PowerPoint Interactive


ActivePresentation.SlideShowWindow.View.Slide


Download 1.37 Mb.
Pdf ko'rish
bet70/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   66   67   68   69   70   71   72   73   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

ActivePresentation.SlideShowWindow.View.Slide
So, for example, if you want to hide shape num ber 7 on the cur rent slide, you
would use this line:
ActivePresentation.SlideShowWindow.View.Slide.Shapes(7).Vis 

ble = False
74 A Scripting Bag of Tricks


Anything af fecting an other slide will start with
ActivePresentation.Slides(NUM)
where
NUM
is replaced by the num ber of the slide. So, for ex ample, if you want to
hide shape number 7 on slide number 2, you would use this line:
ActivePresentation.Slides(2).Shapes(7).Vis 

ble = False
Any ex pression throughout this book that uses a statement to af fect the cur-
rent slide can be changed to use a statement for an other slide, and any expression
that uses a state ment to af fect an other slide can be changed to use a state ment for
the cur rent slide.
Adding PowerPoint Ob jects
In the previous sections, we hid and showed any ob jects that we wanted af-
ter using nor mal PowerPoint drawing features to create the ob jects. Any ob ject
that you can create with PowerPoint drawing tools you can create and manipu-
late with VBA. In fact, you could use VBA to create your en tire pre sentation, in -
cluding all the slides, all the but tons, all the shapes, and all the text. For al most
all your pur poses, you are better off creating the shapes with PowerPoint draw-
ing tools and us ing VBA to hide and show them, but in Chapters 7 and 10, we’ll
see ex amples that cre ate slides and add shapes to them using VBA.
The prob lem with adding shapes is that they can collect in your presenta-
tion and can be hard for you to de lete. For example, consider the star we hid and
showed earlier in this chap ter. In stead of hid ing it and show ing it, we could use
VBA to create it. The problem is that once the shape is cre ated, it is part of the
presentation. Un less you are careful, you will have that shape (and pos sibly sev-
eral cop ies of that shape) in corporated into your presentation. You can de lete the 
shape when you are done, but this is an ex tra thing to track and not generally
worth the effort.
If you are not dis suaded from add ing shapes and would like to try it, you can
try this ex ample. If you heed my warnings, you’ll skip this, go on to the next sec-
tion, and only come back to this to un derstand the examples in Chapters 7 and 10.
Let’s add a sim ple square in the middle of the screen:

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   66   67   68   69   70   71   72   73   ...   191




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling