How to Fix PowerPoint VBA Errors When Moving a Locked Shape
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.

- 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.
Ensure you have saved a backup of your PowerPoint presentation and have the Developer tab enabled to edit and test your VBA macros safely.
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.
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.
Add a line of code to set the Locked property to False (e.g., Shape.Locked = msoFalse) so that the shape becomes movable.
Execute the code that changes the shape's position, adjusting properties like Top or Left as originally intended.
Set the Locked property back to its stored boolean value to ensure the shape returns to its original locked or unlocked state.

Update Microsoft Office or Report the Issue
If unlocking shapes via VBA is unsupported in your current build, you may need to update your software or submit feedback to Microsoft.
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. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
- 2. Install and Launch: Follow the installation prompt, then open WPS Presentation on your computer.
- 3. Open Your Presentation: Drag and drop your existing .pptx files into the workspace to continue editing your slides seamlessly.

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.




