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


Download 1.37 Mb.
Pdf ko'rish
bet135/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   131   132   133   134   135   136   137   138   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

ActivePresentation.
SlideShowWindow.View.GotoSlide
re quires a num ber; that is, it cannot
use the name of the slide in place of the num ber. Fortunately, we can get the slide
number by using the name. To jump to the slide named “Menu,” we could use
the fol lowing two lines:
theSlideIndex = ActivePresentation.Slides("Menu").SlideIndex
ActivePresentation.SlideShowWindow.View.GotoSlide (theSlideIndex)
Although this is a lit tle more com plicated than sim ply us ing a num ber, it is a lot
safer be cause slide names never change unless you change them.
You never have to use ob ject names or slide names. You can do ev erything
you want with numbers. How ever, as you make more com plicated presentations
with more slides and more ob jects, and you be gin to change slides and ob jects
around, using names will save you a lot of grief. When you move ob jects, delete
slides, reorder slides, in sert slides, change the animation or der of ob jects, etc.,
your slide names will remain the same, and your VBA code will continue to
work.
Ar rays
Computer programs can use many dif ferent kinds of data structures. Un der-
standing data structures is an im portant part of computer programming. How-
ever, through out this book I have avoided turn ing you into a pro grammer and
only shown you what you need to know to be a scripter. The topic of data struc-
tures is something you can avoid, but if you un derstand some ba sic data struc-
tures, they can make your life easier. In fact, some of the ex amples that you have
seen could have been simpler with some more ad vanced data structures. I have
made some earlier ex amples lon ger so that they would be easier to understand.
Data structures are a way to store in formation. In Chapter 5 we used the box 
analogy to show how variables can be used to store in formation, but sometimes
information can be stored more easily in something other than a sin gle box. A
collection of numbered boxes might be more suitable. This collection of num-
bered boxes is an array. You might think of an array as an egg carton, with sec-
tions for each of several eggs.
In several ear lier examples, such as the ex ample in “Try Again and Again:
Answer Again Af ter It’s Right” from Chapter 7, we created our own numbered
variables. In that ex ample, we used 

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   131   132   133   134   135   136   137   138   ...   191




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