Article ID: 163531
Article Last Modified on 10/11/2006
Sub CountPlaceholders()
Dim MyShape As shape
Dim lSlideNumber As Long
Dim Count As Long
' Initialize the counter.
Count = 0
' Check to see whether PowerPoint is in slide view.
If ActiveWindow.ViewType = ppViewSlide Then
' Get the current slide number.
lSlideNumber = ActiveWindow.Selection.SlideRange.SlideNumber
' Loop through all shapes in the current slide.
For Each MyShape In ActivePresentation.Slides(lSlideNumber).Shapes
If MyShape.Type = msoPlaceholder Then
' Increment the placeholder counter.
Count = Count + 1
End If
Next MyShape
' Display the total number of placeholders.
MsgBox "You have " & Count & " placeholder(s) on this slide"
Else
MsgBox "You must be in slide view to run this macro.", _
vbInformation
End If
End Sub
176476 OFF: Office Assistant Not Answering Visual Basic Questions
163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: 8.00 ppt8 vba vbe macppt mac_ppt ppt98 powerpt
Keywords: kbcode kbdtacode kbhowto kbmacro kbprogramming KB163531