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


Download 1.37 Mb.
Pdf ko'rish
bet132/191
Sana08.05.2023
Hajmi1.37 Mb.
#1442581
1   ...   128   129   130   131   132   133   134   135   ...   191
Bog'liq
2.2. Powerful PowerPoint For Educators

ActiveWindow.Se 
lec 
tion.
ShapeRange.Name
. This looks at the 
Name
prop erty of the currently se lected
shape. In 
GetObjectName
, we simply re 
turn this name in a 
MsgBox
. In
SetObjectName
, we set this with what ever is typed in an 
InputBox
. The rest
of each of the procedures is to make sure an ob ject is se lected and to clean up
what you typed for the ob ject’s name.
If you run the
GetObjectName
script while an ob 
ject is selected, a
MsgBox
will pop up with the ob ject’s name. You can then use this name in
quotes in stead of an ob ject’s number. For ex ample, if you wanted to hide an ob -
ject named “Pic ture 6,” you can use:
ActivePresentation.SlideShowWindow.View.Slide. _
Shapes("Pic 
ture 6").Vis 
ible = False
As you recall from Chap ter 6, once you add an ob ject to your slide, its name, un -
like its number, will not change un less you change it, so this line of code will al-
ways work even if you change the an imation or der or delete other ob jects on the
slide. Even if you don’t name your own ob jects, each new ob ject that is added to
a slide is given a name that is different from all other objects that have ever been
added to that slide.
When you run 
SetObjectName
, an 
InputBox
will al low you to en ter a
name for an object.
Trim
is used to delete any ex tra spaces before and af ter the
name you type. The pro cedure also checks to make sure you typed something,
because you don’t want to give an ob ject a blank name.
GetObjectName
and 
SetObjectName
check to make sure that one and
only one ob ject is selected, because you can’t get or set the name of more than
one ob ject at a time. If you are look ing for a simpler way to do the same things,
you can try the following scripts, but you are responsible for mak ing sure that
you have selected one and only one object.
What’s in a Name? Finding and Changing Ob ject and Slide Names 131



Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   128   129   130   131   132   133   134   135   ...   191




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