Select Page

It’s sometimes useful to know what type of object you have selected on a slide.

Why?

Consider the case where someone created a circle, added text to it and then prevented someone else from editing the text by copying and pasting the shape back to the slide as a picture. Some users might wonder why they can’t edit the text.

Shape Types in PowerPoint ribbon

You can of course just look at which context sensitive tabs appear in the ribbon when selecting various objects. In our example above, the Picture Tools tab appears when selecting a picture. But what if you want to know what type of object you have selected for any shape type?

The VBA macro below does exactly that.

When you select any single shape on a slide and then run the macro, you’ll see a simple message like this:

Shape Types in PowerPoint message

Using The Macro

If you’ve never used a VBA macro in PowerPoint before, check out our short tutorial which explains how to insert a macro in PowerPoint for the PC or Mac.

The Macro

This macro is provided under the Creative Commons attribution licence. That means you’re free to use it and modify it and all we ask in return is that you credit us with the original creation as described in the code.

'----------------------------------------------------------------------------------
' Copyright (c) 2014 YOUpresent Ltd.
' Source code is provide under Creative Commons Attribution License
' This means you must give credit for our original creation in the following form:
' "Includes code created by YOUpresent Ltd. (YOUpresent.co.uk)"
' Commons Deed @ http://creativecommons.org/licenses/by/3.0/
' License Legal @ http://creativecommons.org/licenses/by/3.0/legalcode
'----------------------------------------------------------------------------------
' Purpose : Reports the type of shape for the selected object on the slide
'
' Author : Jamie Garroch
' Date : 09SEP2014
' Website : http://youpresent.co.uk and http://www.gmark.co
'----------------------------------------------------------------------------------

Option Explicit

Sub GetShapeType()
  Dim oShp As Shape
  Dim sType As String
  ' Check that the selection is a shape range and if not, show a message and exit
  If Not ActiveWindow.Selection.Type = ppSelectionShapes Then GoTo SelectionError
  ' Check if the selection is a single shape and if not, show a message and exit
  If Not ActiveWindow.Selection.ShapeRange.Count = 1 Then GoTo SelectionError
  With ActiveWindow.Selection.ShapeRange(1)
  Select Case True
    Case .Type = msoAutoShape
      sType = "Auto Shape"
    Case .Type = msoCallout
      sType = "Callout"
    Case .Type = msoCanvas
      sType = "Canvas"
    Case .Type = msoChart
      sType = "Chart"
    Case .Type = msoComment
      sType = "Comment"
    Case .Type = msoContentApp
      sType = "Content App"
    Case .Type = msoDiagram
      sType = "Diagram"
    Case .Type = msoEmbeddedOLEObject
      sType = "Embedded OLE Object"
    Case .Type = msoFormControl
      sType = "Form Control"
    Case .Type = msoFreeform
      sType = "Freeform Shape"
    Case .Type = msoGroup
      sType = "Group"
    Case .Type = msoInk
      sType = "Ink"
    Case .Type = msoInkComment
      sType = "Ink Comment"
    Case .Type = msoLine
      sType = "Line"
    Case .Type = msoLinkedOLEObject
      sType = "Linked OLE Object"
    Case .Type = msoLinkedPicture
      sType = "Linked Picture"
    Case .Type = msoMedia
      sType = "Media"
    Case .Type = msoOLEControlObject
      sType = "OLE Control Object"
    Case .Type = msoPicture
      sType = "Picture"
    Case .Type = msoPlaceholder
      sType = "Placeholder"
    Case .Type = msoScriptAnchor
      sType = "Script Anchor"
    Case .Type = msoShapeTypeMixed
      sType = "Mixed Shape"
    Case .Type = msoSlicer
      sType = "Slicer"
    Case .Type = msoSmartArt
      sType = "SmartArt"
    Case .Type = msoTable
      sType = "Table"
    Case .Type = msoTextBox
      sType = "Text Box"
    Case .Type = msoTextEffect
      sType = "Text Effect"
    Case .Type = msoWebVideo
      sType = "Web Video"
  End Select
  MsgBox "The selected object is : " & vbCrLf & vbCrLf & sType, vbInformation + vbOKOnly, "Shape Inspector by youpresent.co.uk"
  End With
  Exit Sub
SelectionError:
  MsgBox "Please select a single object on a slide.", vbCritical + vbOKOnly, "Shape Inspector by youpresent.co.uk"
End Sub