I realized that some shapes in Powerpoint are locked against rotation and flipping. From what I've seen so far (by inspecting the XML within Powerpoint files), there is a flag called noRot which can take the values 0 or 1 this flag resides in the a splocks XML tag. If this flag is set to 1, the shape can't be rotated. This flag, however, seems to be inaccessible using usual Powerpoint means (i.e. I could not find any checkbox representing this flag).
One of those locked elements can be obtained the following way:
- Open Powerpoint 2003 (an empty default presentation should pop up)
- View - Master - Slide master
- The big centered placeholder text box should be locked
I save a presentation containing this text box, opened it in various versions of Powerpoint, selected the saved text box exclusively, and tried the following VBA commands on the selection:
ActiveWindow.Selection.ShapeRange(1).Rotation = 10
ActiveWindow.Selection.ShapeRange(1).Flip msoFlipHorizontal
In all versions, these commands fail.
Setting the rotation fails:
- Powerpoint 2003: "Run-time error 70: Permission denied"
- Powerpoint 2007 onward: "Run-time error -2147024809 (80070057): The shape is locked and cannot be rotated"
Flipping fails:
- Powerpoint 2003: Silently (i.e. without run-time error, but with no observable change)
- Powerpoint 2007 onward: "Run-time error -2147024809 (80070057): The shape is locked and cannot be rotated"
I realized that there is already a product (ShapeLocker) that can lock/unlock those shapes. Apparently, however, this tool seems to modify the XML which seems quite cumbersome.
Is there any known/documented way how to (un)set this flag in VBA (or can it even be done in some Powerpoint checkbox, which I overlooked)?