Powerpoint 2007 - 可以将占位符更改为标题占位符吗?

时间:2011-03-08 14:10:08

标签: vba powerpoint powerpoint-vba contentplaceholder

我发现在创建了几个PowerPoint模板之后,我忘了添加您可以在主视图中找到的“标题”占位符。相反,我添加了文本框占位符,工作正常。但事实证明,有些人使用大纲模式,每张幻灯片的标题都显示在那里。如果未选中“标题”复选框,则在“大纲”模式下查看时,每张幻灯片都没有标题。

所以,我在想是否可以将给定的占位符更改为Title占位符?

1 个答案:

答案 0 :(得分:0)

也许使用VBA。在Visual Basic中粘贴。选择目标占位符/文本框(任何文本)。 然后,运行它。

Sub convertToTitle()
    Dim osld As Slide
    Dim SlideIndex As Long
    Dim oshp As Shape
    Dim oTxR As TextRange
    SlideIndex = ActiveWindow.View.Slide.SlideIndex
    Set osld = ActivePresentation.Slides(SlideIndex)
    Set oshp = ActiveWindow.Selection.ShapeRange(1)
    Set osld = oshp.Parent
    Set oTxR = oshp.TextFrame.TextRange
    With ActivePresentation
        ActivePresentation.Slides(SlideIndex).CustomLayout = ActivePresentation.Designs(1).SlideMaster.CustomLayouts(2)
        'use layout = 2 because it has both Title & Content
        'but you can use any layout as long as it has Title in it
        osld.Shapes.Placeholders.Item(1).TextFrame.TextRange = oTxR.Characters
        oshp.Delete
    End With
End Sub

Voila,它改为Title Placeholder。但是你必须为每张幻灯片运行它。