简体   繁体   English

VBA / Powerpoint:如何列出哪些幻灯片属于任何现有幻灯片母版?

[英]VBA/Powerpoint: How can I list which slides belong to any existing slide masters?

I'm a complete beginner with VBA and learning from existing macros and lots of Google searches. 我是VBA的完全入门者,并且从现有的宏和大量的Google搜索中学习。

I would like to generate a message box that lists the slide master name and the slides that use that master for each master in the presentation. 我想生成一个消息框,其中列出了幻灯片母版名称以及演示文稿中每个母版使用该母版的幻灯片。 Like this: 像这样:

SlideMaster1: 1, 2, 5, 7 SlideMaster1: 1, 2, 5, 7

SlideMaster2: 3, 4, 6, 8 SlideMaster2: 3, 4, 6, 8

SlideMaster3: No slides SlideMaster3: No slides

I have been working with some code for enumerating Designs/Masters from http://skp.mvps.org/designs.htm and it's very rough and basic right now. 我一直在使用一些代码来枚举来自http://skp.mvps.org/designs.htm的 Designs / Masters,现在这是非常粗糙和基础的。

Sub ListSlidesinMasters()

Dim lCtrA As Integer
Dim oPres As Presentation

Set oPres = ActivePresentation
With oPres
        For lCtrA = 1 To .Designs.Count
         MsgBox "Number of masters: " & .Designs.Count & vbCrLf & .Designs(lCtrA).Name & ": " & "unknown" & vbCrLf & "Slide # for active slide: " & ActiveWindow.Selection.SlideRange.SlideIndex

    Next lCtrA
End With
End Sub

This should help: 这应该有助于:

Sub Thing()
    Dim oMaster As Design
    Dim oPres As Presentation
    Dim oSl As Slide
    Dim sTemp As String

    Set oPres = ActivePresentation

    For Each oMaster In oPres.Designs

        sTemp = sTemp & oMaster.Name & vbTab

        For Each oSl In oPres.Slides
            If oSl.Design.Name = oMaster.Name Then
                sTemp = sTemp & CStr(oSl.SlideIndex) & ", "
            End If
        Next

        sTemp = sTemp & vbCrLf

    Next

    Debug.Print sTemp

End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 可以使用VBA切换MS PowerPoint中的幻灯片母版吗? - Can VBA be used to switch slide masters in MS PowerPoint? 如何使用VBA在PowerPoint中将幻灯片复制和粘贴为图片? - How can I copy and paste slides as a picture in PowerPoint using VBA? 打开 PowerPoint 幻灯片时如何运行 VBA 代码 - How can I run VBA code when a PowerPoint slide opens 如何将包含多张幻灯片的 PowerPoint 文件拆分为每个包含 1 张幻灯片的多个文件? - How can I split a PowerPoint file with multiple slides into multiple files of 1 slide each? 如何自动更新在 excel 中具有链接并具有 vba 代码的 powerpoint 中的多张幻灯片? - How will I automatically update multiple slides in powerpoint which has a link in excel and has vba codes? 如何自动隐藏PowerPoint幻灯片? - How can I automate the hiding of PowerPoint slides? Excel vba将幻灯片复制到现有的PowerPoint演示文稿 - Excel vba to copy slides to an existing powerpoint presentation VBA不循环通过任何PowerPoint幻灯片 - VBA not looping through any PowerPoint slides PowerPoint VBA:如何对幻灯片上的所有对象进行分组(不能分组的对象除外)并调整组大小 - PowerPoint VBA: How to group all objects on a slide (except those which are can't be grouped) and resize the group 我如何在Powerpoint(VBA)中选择一系列幻灯片 - How could i Select a Range of Slides in Powerpoint (VBA)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM