×

母版 版式 模板 方案 列表

获取PPT母版和版式的列表

鹭岛小千 鹭岛小千 发表于2021-11-15 22:34:14 浏览731 评论0

抢沙发发表评论

【问题描述】VBA如何获取PPT母版和版式的列表呢?

58-1.png

【小千解答】Designs是设计模板/母版/设计方案的集合,CustomLayouts是版式的集合。

代码如下:

Sub xqoffice()
    Dim i As Byte
    Dim j As Byte
    With ActivePresentation
        For i = 1 To .Designs.Count
            Debug.Print "母版/设计方案" & i & "名称:" & .Designs(i).Name
            With .Designs(i).SlideMaster
                Debug.Print "版式数量:" & .CustomLayouts.Count
                For j = 1 To .CustomLayouts.Count
                    Debug.Print "版式" & j & "名称:" & .CustomLayouts(j).Name
                Next j
            End With
        Next i
    End With
End Sub

运行结果:

58-2.png


打赏码.png


【参考资料】

  1. Designs 对象 (PowerPoint)

  2. CustomLayouts 对象 (PowerPoint)


群贤毕至

访客