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


Cut will change the text to “one two five six seven eight nine ten,” and the Paste


Download 1.37 Mb.
Pdf ko'rish
bet82/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   78   79   80   81   82   83   84   85   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Cut
will change the text to “one two
five six seven eight nine ten,” and the
Paste
will change it to “one two five three 
four eight nine ten.” Change the 
Cut
to 
De 
lete
to get rid of the text with out the
ability to paste it, and change it to 
Copy
to copy the text without re moving it
from the original location.
You can also find out how long (i.e., how many characters) a 
TextRange
is 
with
Length
:
MsgBox (ActivePresentation.SlideShowWindow.View.Slide.Shapes(3). _
.TextFrame.TextRange.Length)
This will pop up a
MsgBox
with the num ber of characters in the third shape of the
cur rent slide.
Finally, you might want to know how many words or paragraphs are in a
TextRange
. You can use 
Count
to find this out:
MsgBox (ActivePresentation.SlideShowWindow.View.Slide.Shapes(3). _
.TextFrame.TextRange.Para 
graphs.Count)
This will pop up a
MsgBox
with the num ber of paragraphs (change
Para 
graphs
to
Words
to get the num ber of words).
Ma nip u lat ing Text: The Mys tery Ex am ple
You have seen many tricks for manipulating text, but you might be wonder-
ing how they might fit into a real ex ample. This section in cludes a simple exam-
ple of a pre sentation that solves a mystery. This is a simple mystery with only
two clues, but you should be able to expand it to in clude more clues. Fig ure 6.7
(page 86) shows the slides in this mystery. Fig ure 6.8 (page 87) shows the VBA
code for the presentation.
In this simple example, most of the nav igation is done with traditional
PowerPoint but tons. The for ward and back ar rows are linked to the next and pre-
vious slides, the “Update Clue Sheet” but ton is linked to the last slide, and the
“Return to Mystery” but ton is linked to the last slide viewed (i.e., if the user just
came from Mys tery Clue #1, it will go back to Mystery Clue #1).
The but tons that use VBA are on the first and last slides. The first slide has
the “Let’s Get Started” but ton that links to the
GetStarted
script. Although we
don’t have to ini tialize any variables, we do have to set up the last slide. This in-
volves setting up the text area (which is the second shape) on the fifth slide with
two paragraphs:

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   78   79   80   81   82   83   84   85   ...   191




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