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


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

GetSlideName
and 
SetSlideName
to find out the name of a
slide and change the name of a slide:
Sub GetSlideName()
MsgBox ActiveWindow.View.Slide.Name
End Sub
Sub SetSlideName()
Dim slideName As String
slideName = InputBox(prompt:="Type a name for the slide")
slideName = Trim(slideName)
If slideName = "" Then
MsgBox ("You did not type any 
thing. " & _
"The name will re 
main " & _
ActiveWindow.View.Slide.Name)
Else
ActiveWindow.View.Slide.Name = slideName
End If
End Sub
These procedures are very sim ilar to
GetObjectName
and 
SetObjectName
.
They also run in Edit View of PowerPoint, so they must be run with the “Mac-
ros” op tion from the “Macro” flyout menu of the Tools menu (see Figure 8.1).
Once you have a slide’s name, you can use it in two ways. If you want to ac-
cess the slide, such as to hide and show ob jects on it, you can use the name in
place of the slide num ber. For ex ample, in “Learn First, Ask Questions Later” in
Chapter 7, we wanted to hide the marks on the menu slide to in dicate that those
sections of the tu torial had not been visited. We used:
ActivePresentation.Slides(2).Shapes(6).Vis 

ble = False
This hides shape 6 on slide 2. If we were to name our menu slide “Menu” and the
object to be hidden “MenuMark1,” we could use the fol lowing line in stead:
ActivePresentation.Slides("Menu").Shapes("MenuMark1").Vis 

ble = False
What’s in a Name? Finding and Changing Ob ject and Slide Names 133


It is slightly more dif ficult to jump to a named slide. 

Download 1.37 Mb.

Do'stlaringiz bilan baham:
1   ...   130   131   132   133   134   135   136   137   ...   191




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