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


Download 1.37 Mb.
Pdf ko'rish
bet185/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   181   182   183   184   185   186   187   188   ...   191
Bog'liq
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 

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   181   182   183   184   185   186   187   188   ...   191




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