VBA & Macro Problems

Fix PowerPoint VBA Duplicate Shape Runtime Error 13

Aamir Naveed AkramAamir Naveed Akram Nov 2, 2026 870 views

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.

How to Fix PowerPoint VBA Duplicate Shape Runtime Error 13
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.
Before you start

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.

Solution 1Recommended

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.

1
Open your VBA Editor

Press ALT + F11 to open the Visual Basic for Applications editor in PowerPoint.

2
Locate the problematic code line

Find the line where you duplicate the shape, which typically looks like Set shpCopy = shpOrig.Duplicate.

3
Modify the assignment statement

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).

4
Test the macro

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.

Extract the Shape from the ShapeRange Object
Alternative Approach: You can also declare your receiving variable as a Variant to hold the ShapeRange directly, but strongly typing it as a Shape and extracting the first index is generally considered better programming practice.
Free Microsoft Office alternative

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. 1. Download the installer: Visit the official WPS Office website and click on 'Download WPS Office Free'.
  2. 2. Install the software: Run the downloaded executable file and follow the simple on-screen instructions to complete the installation.
  3. 3. Open your presentation: Launch WPS Presentation and open your existing .pptx files directly to continue your work seamlessly.
Highly compatible with Microsoft PowerPoint (.ppt and .pptx) file formats.Lightweight architecture ensures smooth performance even on older devices.Familiar user interface requiring no steep learning curve.A rich library of free built-in templates to speed up presentation design.
microsoft office alternative - wps office

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.