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



Yüklə 1,37 Mb.
Pdf görüntüsü
səhifə186/192
tarix16.07.2023
ölçüsü1,37 Mb.
#119622
1   ...   182   183   184   185   186   187   188   189   ...   192
2.2. Powerful PowerPoint For Educators

ActivePresentation.Slides.Add
could re turn the slide ob ject that it cre -
ates (and we could store that in a variable), but be cause we left off the pa renthe-
ses it does not.
Next, we want to add the appropriate text to the slide: the user’s name in the
title area with a brief mes sage; the user’s e-mail ad dress in the text box; and the
user’s idea (if any) in the text box. The code that adds this fol lows.
With ActivePresentation.Slides(11)
.Shapes(1).TextFrame.TextRange.Text = userName & _
" is in 
terested in work 
ing with you."
.Shapes(2).TextFrame.TextRange.Text = "Email: " & userEmail
With .Shapes(2).TextFrame.TextRange
If userIdea = "" Then .Text = .Text & Chr$(13) & _
"No ideas en 
tered" _
Else .Text = .Text & Chr$(13) & "An idea to pon 
der: " & userIdea
End With
End With
This uses a cou ple of 
With
blocks (see Chapter 6) and some fairly simple
text ideas (see also Chapter 6). The
.Shapes(1)
line sets the text in the ti tle
area of the slide. The
.Shapes(2)
line puts the email ad dress in the text area of
the slide. Then, the
With
block (through
End With
) adds the user’s idea to the
text area, or, if the user has no idea, it adds the text “No ideas en tered.” It’s sim -
pler than it looks.
The Pick-A-Partner Tem plate Pro ject 181


Fi nally, the
AddNextSlideButton
pro cedure is called to add a but ton
to go to the next slide:
AddNextSlideButton (11)
The
AddNextSlideButton
pro cedure creates a button on any slide. We
call it with 11 so it will cre ate a but ton on the elev enth slide and 

Yüklə 1,37 Mb.

Dostları ilə paylaş:
1   ...   182   183   184   185   186   187   188   189   ...   192




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə