Ask Your Question
1

How can I create a Powerpoint VBA Macro that specifically moves only the Rectangles to the background?

asked 2022-06-23 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-04-30 19:00:00 +0000

plato gravatar image

Here's a VBA macro that moves all rectangles to the background in PowerPoint:

Sub MoveRectanglesToBackground()
    Dim shp As Shape

    For Each shp In ActivePresentation.Slides(1).Shapes 'change slide number as per your need
        If shp.Type = msoShapeRectangle Then
            shp.ZOrder msoSendToBack
        End If
    Next shp

End Sub

This macro loops through all the shapes on the first slide of the presentation and checks if it is a rectangle. If it is, then it sends the shape to the back of the slide.

Note: This macro will only work for shapes that are strictly rectangles. If you have other shapes that have a rectangular outline or that overlap with rectangles, they may also be sent to the back.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-23 11:00:00 +0000

Seen: 9 times

Last updated: Apr 30 '22