myShape
,
numCorrect
,
userName
,
printableSlide
. You should be able to
tell im me di ately that the fol low ing are pro ce dures:
YourName
,
RightAnswer
,
AddStar
.
For the VBA stuff, you don’t have a choice about capitalization. Most VBA
stuff will be capitalized for you, no matter how you type it. This is a good thing
that can help pre vent bugs.
Don’t Cap i tal ize to Pre vent Bugs
While you are writing your scripts, the VBA Ed itor tries to be helpful. You
might find this an noying at times, but many of its helpful features can prevent fu -
ture problems.
The VBA Ed i tor will au to mat i cally ad just your cap i tal iza tion for you. This
might seem ex cessively meticulous, but you can use it to catch typ ing mistakes.
You’ll no tice that built-in procedures and commands (such as
MsgBox
and
Dim
)
all start with capitals. The only times you should cap italize words your self are in
Dim
state ments (de clar ing vari ables),
Sub
statements (at the beginning of
procedures), and inside quotes.
If you follow the cap italization con vention, after you have de clared a vari -
able with a
Dim
state ment, always type it in lowercase. And af ter you write a pro-
cedure and cap italize it prop erly in the
Sub
statement, if you call the pro cedure
from an other procedure, you can type its name in low ercase. Not only is it easier
to type in low ercase, it will help you catch mistakes.
After you type a line and hit En ter (or click somewhere else in your script),
the VBA Ed i tor will au to mat i cally ad just the cap i tal iza tion. For ex am ple, type
the following:
activepresentation.slideshowwindow.view.next
When you hit En ter, the VBA Ed itor will change it to:
Do'stlaringiz bilan baham: |