Solved

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

Posted on 2012-12-21
2
307 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now