Results 1 to 7 of 7

Thread: positioned second from front in powerpoint vba

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,096
    Location
    It is pretty difficult to do especially with Groups.

    MSFT handle group0s in a verey strange way. A group with say three mshapes inside is treated as FOUR shapes in some places but only 1 in others.

    also zorderposition 1 is the back but you have to calculate what the front would be - bearing in mind how group are counted this is not simple

    This should work but make sure you work on a copy as it might crash.

    Sub moveIT2()
    Dim osld As Slide
    Dim TopZ As Long
    Dim GI  As Long
    Set osld = ActivePresentation.Slides(1)
    GI = osld.Shapes("Group 17").GroupItems.Count
    ' add a shape and check the zorder for the new front then delete it
    With osld.Shapes.AddShape(msoShapeRectangle, 1, 1, 1, 1)
    TopZ = .ZOrderPosition - 1
    .Delete
    End With
    Do
    osld.Shapes("Group 17").ZOrder (msoBringForward)
    ' check the last groupitem not the group itself
    Loop While osld.Shapes("Group 17").GroupItems(GI).ZOrderPosition < TopZ - 1
    End Sub
    Last edited by John Wilson; 06-28-2021 at 07:50 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •