In Powerpoint sometimes it is a bit boring (or challenging), when one has to make the shapes in a presentation the same size and to drag them to the same position. As far as there is no macro recorder there, you only have to find your way around it.
In this article, I will simply show how to iterate through all form in an active slide and simply change their properties. It may seem lame, but it’s not 🙂
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
Option Explicit Public Sub TestMe() Dim sh As Shape Dim sld As Slide Set sld = Application.ActiveWindow.View.Slide For Each sh In sld.Shapes If sh.Fill.ForeColor.RGB <> RGB(210, 210, 210) Then With sh .Fill.ForeColor.RGB = RGB(0, 0, 0) .Width = 700 .Height = 20 .Top = 80 .Left = 30 .Name = "TitleTextBox" .Fill.Visible = msoFalse .Fill.Transparency = 1# End With End If Next sh End Sub |
The objects are Shape and Slide. Slide is accessed through ActiveWindow.View.Slide. All shapes are accessed through the Shapes collection, available in the Slide. The rest is quite easy, we simply set the needed properties.
Cheers! 🙂