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


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

Ti 
tle:="Input Name")
End Sub
Just be sure that the 
Dim
statement, along with all other 
Dim
state ments, is the
first thing in your mod ule regardless of where in the module the
YourName
pro-
ce dure is.
Vari able Types
Variables are of cer tain types. That is, cer tain variables can hold cer tain
kinds of information. If you don’t tell the com puter what kind of in formation the
variable is hold ing in ad vance, it will fig ure it out. In the
String_This__Dim'>String_(a_String'>YourName
pro ce dure,
the function
InputBox
always re turns a vari able of type 
String
(a 
String
is
text), so VBA will fig ure out that 
userName
is a 
String
. How ever, it is a good
idea to be explicit and tell the com puter that you want
userName
to be of type
String
. You can do this by changing the earlier
Dim
state ment:
Dim userName As String
This
 Dim
state ment not only tells the com puter that we want a vari able called
userName
, but it also tells it what kind of in formation that variable can hold (us -
ing our box analogy, it tells it the size and shape of the box). In this case, our
variable will hold a 
String
(i.e., text) of up to 65,536 characters long.
Note that when you type a space after
As
, most ver sions of the VBA editor
will try to suggest things for you to type with a lit tle box that pops up (see Fig ure
5.2).
Figure 5.2. Vari able Type Pop-Up Box
This box contains all the things that you can type now. Boxes like this will pop
up fre quently. If you know what you want to type, just ig nore the box. If you’re
not sure what you want to type, scroll through the list to see the pos sibilities. If
you find what you want on the list, you can either type it yourself or dou ble-click
Vari able Types 53


on it in the box. When you dou ble-click it will ap pear just as if you typed it, ex -
cept that the com puter will never spell it wrong.
For

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   43   44   45   46   47   48   49   50   ...   191




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