[英]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.