Fix PowerPoint VBA Duplicate Shape Runtime Error 13
Question details
The user encounters a Type Mismatch (Runtime Error 13) in PowerPoint VBA when trying to assign a duplicated shape to a Shape variable.

- Product
- PowerPoint VBA
- Device & OS
- not provided
- Scenario
- Automating presentation tasks using a VBA macro to duplicate and manipulate shapes.
- Observed behavior
- A Type Mismatch error is thrown because PowerPoint's Duplicate method returns a ShapeRange object, unlike Excel which returns a Shape object.
Ensure you have the Developer tab enabled in PowerPoint and that your VBA code execution is completely stopped (not in break mode) before modifying the script.
Extract the Shape from the ShapeRange Object
Modify the VBA code to assign the first element of the returned ShapeRange array to your Shape variable.
Unlike Excel, where the Duplicate method returns a single Shape object, PowerPoint's Duplicate method returns a ShapeRange object containing all duplicated shapes.
Attempting to assign a ShapeRange directly to a strongly typed Shape variable causes a Type Mismatch (Runtime Error 13). You must explicitly reference the item within the range.
Press ALT + F11 to open the Visual Basic for Applications editor in PowerPoint.
Find the line where you duplicate the shape, which typically looks like Set shpCopy = shpOrig.Duplicate.
Change the code to target the first item in the ShapeRange by appending (1). The new line should look like: Set shpCopy = shpOrig.Duplicate(1).
Save your code and run the macro again. You will now be able to modify the duplicate's position and properties normally without encountering an error.

Try WPS Office for Seamless Presentation Creation
Looking for a fast, reliable, and cost-effective way to handle your presentations? WPS Presentation provides excellent tools for creating, editing, and managing slides with high compatibility for standard Microsoft Office formats.
- 1. Download the installer: Visit the official WPS Office website and click on 'Download WPS Office Free'.
- 2. Install the software: Run the downloaded executable file and follow the simple on-screen instructions to complete the installation.
- 3. Open your presentation: Launch WPS Presentation and open your existing .pptx files directly to continue your work seamlessly.

Frequently Asked Questions
Why does the same VBA duplicate shape code work in Excel but fail in PowerPoint?
Excel and PowerPoint possess different underlying object models. In Excel, the Duplicate method directly returns a single Shape object. In PowerPoint, it returns a ShapeRange collection, requiring you to specify the index to manipulate an individual shape.
How do I fix a Runtime Error 13 (Type Mismatch) in VBA generally?
A Type Mismatch error occurs when you attempt to assign a value to a variable of a conflicting data type. To fix it, verify the exact object type returned by the function or method in the documentation, and ensure your receiving variable is declared with the matching type.
Can I manipulate multiple duplicated shapes at once in PowerPoint VBA?
Yes. Because the Duplicate method returns a ShapeRange, you can assign it to a variable declared as a ShapeRange. You can then apply formatting, alignment, or positioning to all the duplicated shapes simultaneously without needing to loop through them.




