YourName
and
Ques
tion
procedures. As a scripter, you should think about ways to change a script to make it
do something dif ferent. Simply changing some text should be easy for you. Trans-
form ing
YourName
into
Ques
tion
might be a bit dif ficult at this point, but with
practice, you should be able to find more and more things that you can change.
Running Your Scripts
Before we write any more pro cedures, you should be re minded how to run
procedures. There are three ways to run a pro cedure:
1.
Select “Run Sub/UserForm” from the Run menu in the VBA Ed itor.
2.
Associate your pro cedure with a button so it runs when the user clicks
on it in Slide Show View.
3.
Call the procedure from an other procedure.
Generally, we won’t use method 1. Al though it will work for some of the
simple scripts we have written so far, it will not work for most of our scripts be-
cause we will de sign our scripts to be run in Slide Show View. When we choose
“Run Sub/UserForm,” we are not in Slide Show View.
Most of the time, we will use method 2, associate the pro cedure with a but-
ton. We did this at the beginning of Chapter 4. Re member that pro cedures aren’t
magic; they have to be told to run. The best way to tell them to run is to associate
them with a but ton and to click on that but ton in Slide Show View.
Sometimes we will want to use method 3. In this method we write one
script that in cludes the names of other scripts in it. Our but ton will be as sociated
with the first script, but when that script is run, the other scripts will run as well.
The next section de scribes this in more de tail.
Call ing a Pro ce dure from An other Pro ce dure
Not all pro cedures are tied directly to but tons. Many pro cedures are de -
signed to do part of what you want a but ton to do. These procedures are called
from other procedures. For ex ample, let’s take two procedures we have already
writ ten:
Do'stlaringiz bilan baham: |