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


With ActivePresentation.Slides(5).Shapes(2).TextFrame.TextRange


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

With ActivePresentation.Slides(5).Shapes(2).TextFrame.TextRange
.Para 
graphs(1).Text = "Eye Color:" & Chr$(13)
.Para 
graphs(2).Text = "Hair Color:"
End With
Ma nip u lat ing Text: The Mys tery Ex am ple 85


Fig ure 6.7. The Mys tery Pre sen ta tion Slides
This uses a 
With
block because both paragraphs are part of the 
TextRange
of
the
TextFrame
of the second shape on the fifth slide. Note that we add
Chr$(13)
, the new paragraph symbol, to the end of the first paragraph. Without
it, the paragraphs would run together.
We also want to hide the pic ture of the apple pie (which is the sev enth shape
on the fifth slide) because it will only be shown when the user gets the right an -
swer:
ActivePresentation.Slides(5).Shapes(7).Vis 

ble = False
If you add more clues, up date the 
GetStarted
pro cedure to refer to what-
ever slide num ber is the last slide. That is, change the “5” to an other number in
both lines referring to the slide.
86 A Scripting Bag of Tricks


Figure 6.8. The Mys tery Pre sentation VBA Code


EyeColor
and 
HairColor
are al most identical. The main difference is
that
EyeColor
changes the text in the first paragraph and
HairColor
changes
the text in the second paragraph.
EyeColor
uses an 
InputBox
to prompt for the
eye color and stores what the user types in the vari able
userClue
. The 

Download 1.37 Mb.

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




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