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


Shape and shapes may be visible or not, we can look at the  Vis


Download 1.37 Mb.
Pdf ko'rish
bet34/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   30   31   32   33   34   35   36   37   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Shape
and shapes may
be visible or not, we can look at the 
Vis 

ble
property of these objects. For
example:
ActivePresentation.Slides(3).Shapes(2).Vis 

ble
This looks at the current PowerPoint presentation
ActivePresentation
. That 
pre sen ta tion con tains slides
ActivePresentation.Slides
. We want to look
at the third slide (that’s the 
3
in pa rentheses), and we want to look at the second
shape on that slide (
Shapes(2)
). Finally, that shape, like all shapes, can be vis i-
ble or not, so we want to look at the 
Vis 

ble
prop erty. So, what that small piece
of code says is: Look at the
Vis 

ble
prop erty of the second shape, which is one
of the shapes, on the third slide, which is one of the slides, in the current
PowerPoint presentation. It’s a good thing we can use VBA be cause we would
get pretty tired typ ing out long sentences like that.
If you don’t un derstand the details of ob ject-oriented pro gramming languages,
don’t worry. Because you are learning to be a scripter, you will be able to pick it up
as you go along. The more you un derstand, the easier it will be to change scripts to
suit your pur poses, but to start, you only need to type the scripts you see.
VBA and Vi ruses
VBA is a pow erful pro gramming environment. It can do almost any thing
that can be done to your computer, in cluding creating, de leting, or modifying
files. It can access other pro grams, such as Outlook Ex press (an e-mail pro-
gram). These fea tures have been used to cre ate and spread com puter vi ruses and
worms that de stroy files and spread them to other computers. You could, for ex-
ample, write a VBA pro gram that de letes some im portant sys tem files (mak ing it 
impossible for the computer to start) and mails itself to oth ers through e-mail.
This has been done, and it affects you in two ways. First, once you learn enough
VBA (and it does n’t take that much), you could do this. Don’t!!! Don’t even play 
around with this. It is in appropriate, unethical, and in many cases illegal.
Second, and more relevant to you (since I’m sure you would n’t en tertain
the thought of writing vi 
ruses), some virus pro 
tection systems might look
askance at your legitimate work. The thing you are most likely to see is
PowerPoint’s macro pro tection. This can be found in different places in dif ferent
versions of PowerPoint. In all ver sions of PowerPoint, you start by go ing to the
Tools menu and choosing “Options . . . ”.
VBA and Viruses 37


In older ver sions of PowerPoint (including PowerPoint 97), un der the Gen -
eral tab, there is a checkbox for Macro vi rus pro tection. If this is checked, you
will be asked if it is OK to enable macros every time you run a PowerPoint slide
show or even open a PowerPoint project that con tains any thing done with VBA
(see Figure 3.1).

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   30   31   32   33   34   35   36   37   ...   191




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