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


Download 1.37 Mb.
Pdf ko'rish
bet45/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   41   42   43   44   45   46   47   48   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

InputBox
procedure. This is only a workaround and
is not acceptable to give to stu dents. If you create a but ton
that uses an 
InputBox
, the computer seems to freeze
(your cursor changes to the watch). What is actually hap-
pening is that the com puter has displayed the di alog for the
InputBox
where you can’t see it. It is simply wait ing for
you to type your in put. You can’t see the box, you can’t see
the question, and you can’t see the an swer you type, but
you can type an answer and hit the Return key when you
are done. Fortunately, this does not af fect Win dows at all,
and it only af 
fects one ver 
sion of PowerPoint for the
Macintosh, and you can up grade to a newer ver sion that
works fine.
Vari able Dec la ra tions
For a variable to be useful, you of ten need to declare it. Al though it is not
necessary to de clare all variables, it is good prac tice to do so. De claring a vari -
able does two things for you: It tells the com puter what pro cedures are al lowed
to know about the variable (scope), and it tells the computer what kind of in for-
mation the vari able can hold (type). De claring a variable is very easy. You do it
with the 
Dim
state ment:
Dim userName
This line tells the computer that you want a box called
userName
to store some
information (see Figure 5.1, page 52).
Vari able Dec la ra tions 51
!


Figure 5.1. A Box Called
userName
Be ware! All 
Dim
statements must go to gether at the top of
your mod ule (or right after the
Sub
line in a pro cedure).
Never put a 
Dim
statement be tween pro cedures. If you add
a new pro cedure that needs a new variable, put the pro ce-
dure where you want, and put the

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   41   42   43   44   45   46   47   48   ...   191




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