Get shape by ID
PowerPoint's UI does not display shape IDs. You must inspect the underlying Open XML.
Method 1 - Unzip the file
A .pptx is a ZIP archive.
Copy the file and rename the extension from
.pptxto.zip.Extract it.
Open
ppt/slides/slide1.xml(numbering matches slide order) in a text editor.Locate the shape's
<p:nvSpPr>block. The ID is theidattribute on<p:cNvPr>:
<p:spTree>
<p:nvGrpSpPr>
<p:cNvPr id="2" name="Textbox 1"/>
</p:nvGrpSpPr>
<p:sp>
<p:nvSpPr>
<p:cNvPr id="3" name="Chart 1"/>
</p:nvSpPr>
</p:sp>
</p:spTree>This slide contains 2 shapes, with IDs 2 and 3. The name attribute is the Selection Pane name, which is your bridge between the visual editor and the XML.
Method 2 - python-pptx
Method 3 - VBA
Run from the VBA editor (Alt+F11) and read output in the Immediate Window (Ctrl+G).
Notes
Shape IDs are unique per slide, not per presentation. Always pair a shape ID with its slide index.
IDs are stable across saves and edits, but a copy-pasted shape receives a new ID.
Shapes inside a group have their own IDs; the group itself also has one.
Placeholders from the layout carry IDs like any other shape.
Reference: shapes
Download: input.zip | output.pptx


Last updated