Solved

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

Posted on 2012-12-21
2
309 Views
Last Modified: 2012-12-21
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
Comment
Question by:AndreasHermle
2 Comments
 
LVL 5

Accepted Solution

by:
LazyFolk earned 500 total points
ID: 38712379
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
 

Author Closing Comment

by:AndreasHermle
ID: 38712451
Hi LazyFolk,

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

Regards, Andreas
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question