logo
search
Office Settings & Configuration

How to Disable PowerPoint Shape Lock and Unlock Commands with Ribbon XML

Chanuka GeekiyanageChanuka Geekiyanage Oct 21, 2026 869 views

Question details

The user needs to disable the Lock and Unlock options in the context menu for shapes in PowerPoint by editing the Ribbon XML.

How to Disable PowerPoint Shape Lock and Unlock Commands with Ribbon XML
Product
PowerPoint
Device & OS
not provided
Scenario
Customizing the PowerPoint user interface or developing an add-in to restrict users from locking or unlocking shapes.
Observed behavior
The user wants to override the default ContextMenuShape to disable the LockObject and UnlockObject controls.
Before you start

Ensure you have a basic understanding of Ribbon XML customization and have access to edit the XML structure of your PowerPoint add-in or presentation file.

Solution 1Recommended

Use Ribbon XML to Disable Lock and Unlock Identifiers

Inject specific Ribbon XML code into your PowerPoint add-in or presentation to target and disable the LockObject and UnlockObject controls in the shape context menu.

PowerPoint uses Fluent UI control identifiers for its commands. To disable the shape lock and unlock features in the context menu, you must target the ContextMenuShape and set the enabled attribute of both LockObject and UnlockObject to false.

1
Open the Custom UI Editor

Open your PowerPoint presentation (.pptx) or add-in (.ppam) using a Custom UI Editor tool or by renaming the file extension to .zip and modifying the XML directly.

2
Define the Custom UI Namespace

Ensure your XML declaration uses the 2009/07 customUI namespace by adding xmlns="http://schemas.microsoft.com/office/2009/07/customui" to the root customUI element.

3
Add the Context Menu XML Block

Insert the following code block inside the customUI element: <contextMenus><contextMenu idMso="ContextMenuShape"><button idMso="LockObject" enabled="false" /><button idMso="UnlockObject" enabled="false" /></contextMenu></contextMenus>.

4
Save and Reload the Presentation

Save the modified XML file, repackage the file if you are manually editing the zip archive, and open the presentation in PowerPoint. Right-click a shape to verify the Lock and Unlock options are disabled.

Use Ribbon XML to Disable Lock and Unlock Identifiers
Test Customizations Successfully: Make sure to test the right-click context menu on various shape types in PowerPoint to ensure the commands are uniformly disabled across your customized interface.
Free Microsoft Office alternative

Edit Presentations Seamlessly with WPS Office

If managing complex Ribbon XML configurations in PowerPoint becomes cumbersome, consider switching to WPS Office. It provides a clean, user-friendly interface for creating professional presentations with full support for Microsoft Office file formats.

  1. 1. Download WPS Office: Visit the official WPS website and click the free download button to get the software installer.
  2. 2. Install the Suite: Run the installer and follow the quick on-screen instructions to set up WPS Office on your device.
  3. 3. Open Your Presentation: Launch WPS Presentation and seamlessly open your existing .pptx files to start editing immediately.
Completely free and lightweight office suiteHighly compatible with Microsoft PowerPoint (.pptx) formatsFamiliar user interface requiring no steep learning curveBuilt-in advanced shape formatting and layout tools
microsoft office alternative - wps office

Frequently Asked Questions

What schema is required for context menu customization in PowerPoint?

You must use the 2009/07 customUI schema (http://schemas.microsoft.com/office/2009/07/customui), as context menu customizations were introduced in Office 2010 and are not supported by the older 2006/01 schema.

Can I hide the shape lock command instead of just disabling it?

Yes. Instead of using the enabled="false" attribute, you can use the visible="false" attribute in your Ribbon XML for both the LockObject and UnlockObject buttons to completely hide them from the context menu.

What are the exact control identifiers for shape locking?

The specific Fluent UI control identifiers required to target these commands in PowerPoint are LockObject for locking a shape and UnlockObject for unlocking a shape.

Does this Ribbon XML apply to all shapes in the presentation?

Yes, by targeting idMso="ContextMenuShape", the customization applies to the default right-click context menu of standard shapes throughout the presentation where the XML is loaded.