Solved

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

Posted on 2012-12-21
2
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel - Save a copy of work book 13 91
Protecting vb6 & .Net code Obfuscation 18 184
Automatic Email Reminder 4 77
Get the Y value of a line at X in a chart in VBA 28 31
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

730 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