Show me the .Type of each object on a slide
This macro from Brian Reilly and Naresh Nichani tells you the .Type of each shape on a slide:
Sub Object_Types_on_This_Slide()
'Refers to each object on the current page and returns the Shapes.Type
'Can be very useful when searching through all objects on a page
Dim it As String
Dim i As Integer
'''''''''''''''''
'Read-only Long
'''''''''''''''''
For i = 1 To ActiveWindow.Selection.SlideRange.Shapes.Count
'No need to select the object in order to use it
With ActiveWindow.Selection.SlideRange.Shapes(i)
'But it is easier to watch when the object is selected
'This next line is for demonstration purposes only. It is not necessary
ActiveWindow.Selection.SlideRange.Shapes(i).Select
''''''''''''''''''''''''
Select Case .Type
Case msoAutoShape 'Type 1
it = "an AutoShape"
Case msoCallout 'Type 2
it = "a Callout"
Case msoChart 'Type 3
it = "a Chart"
' Note that you'll never actually SEE one of these in PPT. It's an Excel-only thing.
Case msoComment 'Type 4
it = "a Comment"
Case msoFreeform 'Type 5
it = "a Freeform"
Case msoGroup 'Type 6
it = "a Group"
Case msoEmbeddedOLEObject 'Type 7
it = "an Embedded OLE Object"
Case msoFormControl 'Type 8
it = "a Form Control"
Case msoLine 'Type 9
it = "a Line"
Case msoLinkedOLEObject 'Type 10
it = "a Linked OLE Object"
With .LinkFormat
MsgBox (.SourceFullName)
End With
Case msoLinkedPicture 'Type 11
it = "a Linked Picture"
With .LinkFormat
MsgBox (.SourceFullName)
End With
Case msoOLEControlObject 'Type 12
it = "an OLE Control Object."
Case msoPicture 'Type 13
it = "a embedded picture."
Case msoPlaceholder 'Type 14
it = "a text placeholder (title or regular text--not a standard textbox) object."
Case msoTextEffect 'Type 15
it = "a WordArt (Text Effect)."
Case msoMedia 'Type 16
it = "a Media object .. sound, etc."
With .LinkFormat
MsgBox (.SourceFullName)
End With
Case msoTextBox 'Type 17
it = "a Text Box"
Case msoScriptAnchor 'Type # not checked
it = " a ScriptAnchor"
Case msoTable
it = " a Table" 'Type 19
Case msoShapeTypeMixed 'Type # not checked
it = "a Mixed object (whatever that might be)."
Case Else 'Just in case MS adds some new types
it = "a mystery!!! ?An undocumented object type?" & _
" Haven't found one of these yet"
End Select
MsgBox ("I'm " & it & " Type is # " & .Type)
End With
Next i
End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.