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

PPTools

Image Export converts PowerPoint slides to high-quality images.

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

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

FixLinks prevents broken links when you distribute PowerPoint presentations

Optimizer saves disk space and bandwidth, "right-sizes" your PowerPoint presentations for email, screenshow or printing

PPT2HTML gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF

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.

Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2010 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.
Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese

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.htm
Last update 31 March, 2007
Created: