Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Resetting positions of shapes

Problem

PowerPoint doesn't allow you to lock shapes to prevent their being moved. Sometimes this can be very convenient, especially if you have to make edits to files you're not familiar with.

Solution

We can't make PowerPoint add shape locking, but the two little macros below are almost as good. Run the first on a presentation to record the position and size of each shape in the presentation.

Run the second to reset each shape to the recorded position/size.

The macro will not change the size/position of any shapes you've added, but will reset shapes you've copied after running the first macro.

Sub Setup()
    Dim oSl As Slide
    Dim oSh As Shape

    For Each oSl In ActivePresentation.Slides
        For Each oSh In oSl.Shapes
            With oSh
                .Tags.Add Name:="L", Value:=CStr(.Left)
                .Tags.Add Name:="T", Value:=CStr(.Top)
                .Tags.Add Name:="H", Value:=CStr(.height)
                .Tags.Add Name:="W", Value:=CStr(.width)
            End With
        Next
    Next

End Sub

Sub ReSet()

    Dim oSl As Slide
    Dim oSh As Shape
    Dim sTest As String
    For Each oSl In ActivePresentation.Slides
        For Each oSh In oSl.Shapes
            With oSh
                ' skip untagged shapes:
                sTest = .Tags("L") & .Tags("T") & .Tags("H") & .Tags("W")
                If Len(sTest) > 0 Then
                    .Left = CSng(.Tags("L"))
                    .Top = CSng(.Tags("T"))
                    .height = CSng(.Tags("H"))
                    .width = CSng(.Tags("W"))
                End If
            End With
        Next
    Next

End Sub

See How do I use VBA code in PowerPoint? to learn how to use this example code.


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Resetting positions of shapes
http://www.pptfaq.com/FAQ00860_Resetting_positions_of_shapes.htm
Last update 07 June, 2011
Created: