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


Download 1.37 Mb.
Pdf ko'rish
bet98/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   94   95   96   97   98   99   100   101   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

LTrim
or 
RTrim
re spec tively.
If you are not concerned with how your students cap italize their an swers,
LCase
can set the an swer to lowercase by adding:
answer = LCase(an 
swer)
This takes the an swer that the stu dent typed, con verts all cap ital let ters to low er-
case let ters, and puts the lowercase ver sion back in the vari able
an 
swer
. This
will change “Annapolis,” “AnNaPolis,” and “AnnApolis” to “annapolis.” If you
are test ing to make sure the stu dent knows to cap italize the first let ter of a city
name, don’t use
LCase
.
Warn ing! The answer is now lowercase. This means that
your
If
state ment needs to com pare it to a lowercase re -
sponse.
If an 
swer = “Annapolis” Then
will never
be
True
be 
cause “annapolis” is not the same as
“Annapolis” and 
LCase
changes all cap i tal iza tions of
“Annapolis” to “annapolis.” So even if the student types
“Annapolis,”
LCase
will change it to “annapolis” and
mark it wrong when comparing it to “Annapolis.”
If you are willing to accept al ternative spellings or alternative answers, you
can test for all the alternatives that you want in your
If
statement:
If an 
swer = "annapolis" Or _
an 
swer = "anapolis" Or _
an 
swer = "annappolis" Or _
an 
swer = "anappolis" Then
Include as many or as few different al ternatives as you like. Just re member that if 
you used 
LCase
, all your al ternatives must be lowercase.
If we use all our tricks (ig noring ex tra spaces, ac cepting any capitalization,
and allowing al ternative answers), our pro cedure will look like this:
Do Spelling and Spacing Count? 101

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   94   95   96   97   98   99   100   101   ...   191




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