我想知道 Powerpoint 是否有一项功能,可以自动向显示章节和/或章节的每张幻灯片添加格式化标题。我正在展示我的论文,它分为几个部分,例如“方法”或“评估”,如果我可以在每张幻灯片的标题中自动显示它,我会很高兴。最好是从我的幻灯片部分自动获取。
我想要这个外观,我目前正在为每张幻灯片手动制作它。
下面是一些起始代码,可让您了解每张幻灯片所属部分的名称。您需要提供代码以将文本添加到每张幻灯片并对其进行定位/格式化。
Sub Test()
Dim oSl As Slide
' Make sure there ARE sections
If ActivePresentation.SectionProperties.Count > 0 Then
For Each oSl In ActivePresentation.Slides
Debug.Print GetSection(oSl)
Next
End If
End Sub
Function GetSection(oSl As Slide) As String
' Returns the name of the section that this slide belongs to.
With oSl
Debug.Print .sectionIndex
GetSection = ActivePresentation.SectionProperties.Name(.sectionIndex)
End With
Run Code Online (Sandbox Code Playgroud)