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


Download 1.37 Mb.
Pdf ko'rish
bet171/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   167   168   169   170   171   172   173   174   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Sub
and an 
End Sub
is in dented one level.
2.
Everything that is part of a block is in dented. This includes parts of an
If
block (such as ev erything be tween an 
If
and 
ElseIf
or ev erything
164 De bug ging Tips


be tween an
ElseIf
and the next 
ElseIf
or ev erything be tween an
Else
and an 
End If
). This also in cludes loops (such as everything
be tween a
For
and 
Next
or ev erything be tween a 
While
and 
Wend
).
3.
Lines that are continued from the previous line (where the pre vious
line ends with an un derscore) are in dented.
Indenting helps you see that something is a part of something else: A group of
lines is part of the 
Sub
, a group of lines is part of the
ElseIf
por tion of an
If
block,
a con tinued line is a part of the previous line, etc. Look at the following ex ample:
Sub NestedIf()
If gradeNum > 90 Then
MsgBox ("Great job. You got an A.")
If gradeNum = 100 Then
MsgBox ("You are per 
fect.")
End If
ElseIf gradeNum > 80 Then
MsgBox ("Good work. B is a very good grade.")
ElseIf gradeNum > 70 Then
MsgBox ("Not bad. C is still pass 
ing.")
If gradeNum < 72 Then
MsgBox ("That was close. You were lucky to get a C.")
End If
Else
MsgBox ("You can do better than this.")
End If
If gradNum > 70 Then
MsgBox ("You have passed this class.")
End If

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   167   168   169   170   171   172   173   174   ...   191




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