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


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

Sub GetObjectName()
If ActiveWindow.Se 
lection.Type = ppSelectionShapes _
Or ActiveWindow.Se 
lection.Type = ppSelectionText Then
If ActiveWindow.Se 
lection.ShapeRange.count = 1 Then
MsgBox (ActiveWindow.Se 
lection.ShapeRange.Name)
Else
MsgBox ("You have se 
lected more than one shape.")
End If
Else
MsgBox ("No shapes are se 
lected.")
End If
End Sub
Sub SetObjectName()
Dim objectName As String
If ActiveWindow.Se 
lection.Type = ppSelectionShapes _
Or ActiveWindow.Se 
lection.Type = ppSelectionText Then
If ActiveWindow.Se 
lection.ShapeRange.count = 1 Then
objectName = InputBox(prompt:="Type a name for the ob 
ject")
objectName = Trim(objectName)
130 More Tricks for Your Scripting Bag


If objectName = "" Then
MsgBox ("You did not type any 
thing. " & _
"The name will re 
main " & _
ActiveWindow.Se 
lec 
tion.ShapeRange.Name)
Else
ActiveWindow.Se 
lec 
tion.ShapeRange.Name = objectName
End If
Else
MsgBox _
("You can not name more than one shape at a time. " _
& "Se 
lect only one shape and try again.")
End If
Else
MsgBox ("No shapes are se 
lected.")
End If
End Sub
If you are try ing to un derstand these pro cedures, pay careful attention to the
nested
If
statements and how they are in dented in the example.
The heart of these pro 
cedures is 

Download 1.37 Mb.

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




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