[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

Record the position and size of the (only) shape on the current slide

Below macro records the position and size of each shape in the active presentation.

How is the code to be re-written if I only would like to record the position and size of the (only) shape on the current slide?

Help is much appreciated. Thank you very much in advance.

Regards, Andreas




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

Open in new window

0
AndreasHermle
Asked:
AndreasHermle
1 Solution
 
LazyFolkCommented:
Test this...
It loop on all shapes in the current slide

Sub test()
    Dim oSh As Shape
    
    For Each oSh In ActivePresentation.Slides.Range(ActiveWindow.Selection.SlideRange.SlideNumber).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
End Sub

Open in new window

0
 
AndreasHermleAuthor Commented:
Hi LazyFolk,

great this did the trick. Thank you very much for your great help.

Regards, Andreas
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now