问题描述
我想知道Powerpoint是否具有一项功能,可以在其中将格式化的标题自动添加到显示该部分和/或章节的每张幻灯片中。我正在介绍我的论文,它分为几个部分,例如“方法”或“评估”,如果我能自动在每张幻灯片的标题中显示它,我将非常喜欢。最好是从我的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
,
PowerPoint没有内置的功能。
但是,与大多数Office产品一样,PowerPoint确实具有非常强大的VBA宏引擎,肯定可以做到这一点。
您的宏将必须基于您选择用来标记该名称的任何参数来捕获“部分”名称,然后才能将该信息放置在后续幻灯片中的任意位置。
由于幻灯片与视觉布局有关的不仅仅是编程自动创建,因此您必须自己构建。