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


Download 1.37 Mb.
Pdf ko'rish
bet68/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   64   65   66   67   68   69   70   71   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

Ref er enc ing Ob jects by Name
Every ob ject on a slide has a name. Any thing you can do with an ob ject’s
number, you can do with its name. Names are better than numbers be cause
names of ob jects don’t change un less you change them. The bad news is that
there is no easy way (in any ver sion of PowerPoint) to get the name of an ob ject.
Using VBA to de termine the name of an ob ject or change the name of an ob ject
is described in Chapter 8.
There is some logic to the names that are given to ob jects, so you might be
able to fig ure out the name of an ob ject. Each ob ject’s name starts with the type
of ob ject fol lowed by a num ber. The main types of ob jects are Text Box, Rectan-
gle, Line, Oval, Picture, and AutoShape. If the ob ject is n’t one of the other types,
it is prob ably AutoShape. The num bers are as signed in or der as the shapes are
added to the slide, ex cept that the num bering al ways starts with 2. Therefore, if
you add a text ob ject, a rectangle, and but ton to a blank slide, the ob jects will be
named Text Box 2, Rectangle 3, and AutoShape 4 (see Figure 6.5). If there are
already ob jects on the slide, the numbers will start higher. For example, if you
add the same shapes to a bulleted list slide, the slide al ready con tains Rectangle 2
(the title area) and Rect angle 3 (the bulleted list area), so your added shapes will
be Text Box 4, Rectangle 5, and AutoShape 6.
Figure 6.5. Shapes on a Slide, with Names in Quo tations Be low
Ref er enc ing Ob jects by Name 73
" "
" " " "


These names do not change un less you change them. If you de lete Text Box
4, Rectangle 5 and AutoShape 6 will keep the same name, and noth ing will have
a name with 4 in it. The number added to new names keeps go ing up even when
you de lete shapes. Thus, if you add the above shapes and then delete them and
then in sert a picture from clip art, the picture will be named Pic ture 7 even
though no ob jects in clude 4, 5, and 6 in their names.
In or der to use the name of an ob ject, use it in quotes in the same place you
would use the ob ject num ber. Thus, to hide a shape named Text Box 4 on slide
number 5, you could use the following line:

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   64   65   66   67   68   69   70   71   ...   191




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