Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PowerPointで指定したShapeを最背面にし、サイズをスライド一面にし、センタリングするマクロ
Sub SetBackground()
targetNameArr = Array("Picture 6", "Content Placeholder 6")
Dim w As Integer
Dim h As Integer
w = ActivePresentation.PageSetup.SlideWidth
h = ActivePresentation.PageSetup.SlideHeight
Dim sld As Slide
Dim sh As Shape
For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
For Each targetName In targetNameArr
If sh.Name = targetName Then
sh.Width = w
sh.Height = h
sh.ZOrder (msoSendToBack)
Set myRange = sld.Shapes.Range(Array(targetName))
myRange.Align msoAlignCenters, msoTrue
myRange.Align msoAlignMiddles, msoTrue
End If
Next
Next
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment