Retrieve the name of a shape

There are two types of shapes in MS Word- InlineShapes and Shapes. It's quite easy to check name of shape object with some VBA code:

  1. select shape
  2. press Alt+F11 to open VBA Editor
  3. in Immediate window execute this code: ? Selection.ShapeRange.Name
  4. as a result you get name of the shape.

InlineShape doesn't have name property therefore you can't check it's name until you promote your InlineShape to Shape type object.


Microsoft Word 2010 onwards

From Microsoft Word 2010 onwards (2010, 2013 and 2016) there is an "Selection Pane" included in Microsoft Word. On the selection pane the Microsoft Word InlineShapes as well as the Shapes are listed and named.

You can find the Selection Pane in the menu under

  1. "Home"-tab
  2. "Editing"-group
  3. "Select"-button
  4. "Selection Pane..."

Microsoft Word versions before 2010

For older Microsoft Word (2003, 2007) versions use the VBA approach (?Selection.ShapeRange.Name) as Kazimierz Jawor posted as an other answer to this question: https://stackoverflow.com/a/17680650

Tags:

Ms Word

Vba