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


msoTrue (which is ba sically the same as  True


Download 1.37 Mb.
Pdf ko'rish
bet174/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   170   171   172   173   174   175   176   177   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

msoTrue
(which is ba sically the same as 
True
), which means that the slide will
be re set. Fi nally, you will notice that 
In 
dex
is in bold. That means that the next
thing I type will be the value used for
In 
dex
. If I type a number and then a
comma,
ResetSlide
will be come bold, meaning that the next value I type will
be the value for 
ResetSlide
. If you type pa rameters in or der, you can just type
the values as in the following:
ActivePresentation.SlideShowWindow.View.GotoSlide(5,True)
If you don’t type them in order, you can use the parameter name, fol lowed by co -
lon equals sign (
:=
), fol lowed by the value, as in the fol lowing:
ActivePresentation.SlideShowWindow.View.GotoSlide(ResetSlide:=True, _
In 
dex:=5)
This is very help ful for a cou ple of reasons. First, you don’t always have to
look up which pa rameters are needed. For example, when add ing a shape, I can
never re member which comes first and sec ond:
Top
and 
Left
or 
Width
and
Height
. I don’t need to remember because VBA will tell me, as in Figure 9.5.
Fig ure 9.5. VBA Ed i tor Sug gests Pa ram e ters for the
AddShape
 Method
Second, you al ways know what the procedure expects. If you leave off any re -
quired parameters (such as forgetting to specify
Width
and 
Height
), it won’t
work.
Hints from the VBA Ed itor 167


VBA Help
While Win dows versions of the VBA Ed itor are better at sug gesting things
as you type, Macintosh ver sions have help that is a bit easier to use. In ei ther ver-
sion of VBA, you can choose one of the selections from the Help menu to search
for a keyword. In the Macintosh ver sion, you can high light a key word, ob ject, or
method in your code and hit the Help key on your keyboard. This will bring up
help that is directly related to what you are trying to do.
When you are using help, you can get all the in formation that pops up on
your screen when you type open parenthesis and VBA sug gests pa rameters. You 
should also check out the examples to help you un derstand what you are doing
better.
Com mon Bugs
Everyone makes mistakes, and ev eryone makes their own mistakes. How-
ever, a few mistakes are fairly common. If you can’t track down a bug, you
might look for some of these things. The bugs listed below are particularly tricky
to find because they are not a prob lem with a spe cific pro cedure. If one pro ce-
dure is not work ing at all or is giv ing the wrong re sults, you can usu ally find the
bug if you stare at that pro cedure long enough (or use some of the above tech-
niques to track it down). However, the following bugs cause prob lems for proce-
dures that are completely cor rect and might have been working a minute earlier.
No matter how long you stare at a pro cedure, you won’t find the bug if it is
caused by something outside the procedure.

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   170   171   172   173   174   175   176   177   ...   191




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