Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…

911 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