我有很多幻灯片,每张幻灯片都有一个单词艺术。我希望将艺术这个词与幻灯片的绝对中心对齐。我试过的代码是:
Option Explicit
Sub format()
Dim sl As Slide
Dim ob As Object
For Each sl In ActivePresentation.Slides
For Each ob In sl.Shapes
With ob.TextFrame
' .TextRange.Paragraphs.ParagraphFormat.Alignment = ppAlignCenter
' .TextRange.Paragraphs.ParagraphFormat.Alignment = ppAlignMiddle
.HorizontalAnchor = msoAnchorCenter
.VerticalAnchor = msoAnchorMiddle
End With
Next ob
Next sl
End Sub
答案 0 :(得分:0)
也许它会帮助你。
Option Explicit
Sub format()
Dim sl As Slide
For Each sl In ActivePresentation.Slides
sl.Shapes.Range.Align msoAlignCenters, msoTrue
sl.Shapes.Range.Align msoAlignMiddles, msoTrue
Next sl
End Sub