Others

How to Fix PowerPoint VBA Errors When Moving a Locked Shape

Aamir Naveed AkramAamir Naveed Akram Oct 28, 2026 871 views

Question details

The user encounters a VBA error in PowerPoint when attempting to move or change the properties (such as the Top position) of a shape that is locked.

How to Fix PowerPoint VBA Errors When Moving a Locked Shape
Product
Microsoft PowerPoint
Device & OS
not provided
Scenario
Automating presentation edits by moving shapes and adjusting their positional properties using a VBA macro.
Observed behavior
Running the VBA script throws a runtime error because the script is trying to modify the position of a locked shape, a restriction introduced in newer Office builds.
Before you start

Ensure you have saved a backup of your PowerPoint presentation and have the Developer tab enabled to edit and test your VBA macros safely.

Solution 1Recommended

Temporarily Unlock the Shape Using VBA

Modify your VBA code to check and temporarily disable the lock before moving the shape, then restore its original locked state.

In recent versions of PowerPoint, shapes can be locked from the user interface, which also restricts modifications via VBA. To bypass this error without permanently unlocking the shape, you must write your script to handle the locked state dynamically.

1
Store the current state

Declare a boolean variable in your VBA script and use it to store the current value of the shape's Locked property before making any changes.

2
Unlock the shape

Add a line of code to set the Locked property to False (e.g., Shape.Locked = msoFalse) so that the shape becomes movable.

3
Modify shape position

Execute the code that changes the shape's position, adjusting properties like Top or Left as originally intended.

4
Restore the lock

Set the Locked property back to its stored boolean value to ensure the shape returns to its original locked or unlocked state.

Temporarily Unlock the Shape Using VBA
Best Practice: Always use error handling (like On Error Resume Next) cautiously when dealing with new object properties that might not be supported in older versions of PowerPoint.
Free Microsoft Office alternative

Try WPS Office for Seamless Presentation Editing

If you are experiencing macro errors and compatibility bugs with specific Office builds, consider switching to WPS Office. It provides a highly compatible, free, and lightweight alternative for creating and managing professional presentations.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
  2. 2. Install and Launch: Follow the installation prompt, then open WPS Presentation on your computer.
  3. 3. Open Your Presentation: Drag and drop your existing .pptx files into the workspace to continue editing your slides seamlessly.
Highly compatible with Microsoft PowerPoint (.pptx) formats and objects.Lightweight architecture ensures fast startup and smooth operation.Familiar user interface requires absolutely no learning curve for migration.Rich library of built-in templates and design tools available for free.
microsoft office alternative - wps office

Frequently Asked Questions

Why does PowerPoint throw an error when I move a locked shape in VBA?

In newer versions of PowerPoint, shapes can be locked to prevent accidental edits. When a shape is locked, modifying its positional properties (like Top or Left) via VBA is restricted by the application, which triggers a runtime error.

How do I check if a shape is locked using VBA?

You can verify a shape's locked status by checking its 'Locked' property in your VBA code. If the property returns True, the shape is currently restricted and must be unlocked before moving.

Can I lock and unlock shapes in older versions of PowerPoint?

Shape locking through both the user interface and VBA is a relatively new feature introduced in modern Microsoft 365 and newer Office builds. Older versions of PowerPoint may not recognize the 'Locked' property, which can also cause script errors.