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


Download 1.37 Mb.
Pdf ko'rish
bet55/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   51   52   53   54   55   56   57   58   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

YourName
and 
DoingWell
(for sim 
plicity we’ll use our first
YourName
pro cedure, but you could use any of the 
YourName
pro ce dures from
this chapter):
Call ing a Pro ce dure from An other Pro ce dure 59


Dim userName As String
Sub YourName()
userName = InputBox(prompt:="Type your name", _
Ti 
tle:="Input Name")
End Sub
Sub DoingWell()
MsgBox("You are do 
ing well, " & userName)
End Sub
You could as sociate a but ton with each of these pro cedures, so the us ers
click on the first button to type their names and (probably at some later point)
click on the other but ton to be told how well they are do ing. What if we want to
praise them right away, to encourage them right after they have typed a name?
We could write another procedure that calls the two pro cedures above:
YourNameWithPraise()__YourName__DoingWell_End_Sub_No_but_tons_have_to_be_as_sociated_with_YourName_or_DoingWell'>Sub YourNameWithPraise()
YourName
DoingWell
End Sub
No but tons have to be as sociated with 
YourName
or
DoingWell
. Cre ate a but-
ton and as sociate it with 
YourNameWithPraise
, and that is all you need. The
but ton will ac ti vate 
YourNameWithPraise
. When 
YourNameWithPraise
starts to ex ecute it will see the first line: 
YourName
. That sig nals it to run the
YourName
pro cedure. When it finishes the
YourName
pro cedure, it will run
DoingWell
. Your module will look like Figure 5.5.
Fig ure 5.5. YourNameWithPraise Calls YourName and DoingWell
60 Let’s Get Scripting


Con clu sion
You now have learned a few ba sic scripts to in teract with your stu dents.
You can get in put and use it in feedback, ei ther to in clude a student’s name in the 
feedback or to judge a short-answer question. In the next chap ter you will ex-
pand your bag of VBA tricks, in cluding ways to manipulate your PowerPoint
slides, such as moving from slide to slide and hiding ob jects on your slides.

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   51   52   53   54   55   56   57   58   ...   191




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