Powerpoint 2010 VBA:不要为具有特定标题的幻灯片编号

时间:2016-03-31 21:06:31

标签: vba powerpoint-vba powerpoint-2010

我最近写了一个不会隐藏幻灯片的宏。也就是说,当幻灯片被隐藏时,它将不计入整个卡座的编号中,因此如果隐藏幻灯片3,编号将会出现:

幻灯片1,编号1 幻灯片2,编号2 幻灯片3,(无号码) 幻灯片4,编号3

对于所有标题为"议程"?的幻灯片,是否有办法完成同样的事情?我希望我的幻灯片以幻灯片模式显示,但我不希望它们计入幻灯片的编号。

基本上,有没有办法在if语句中引用幻灯片标题文本?

谢谢!

1 个答案:

答案 0 :(得分:1)

如果在包含不区分大小写的文本“议程”的给定幻灯片上找到标题占位符,则返回true:

' ===========================================================================
' Purpose : Determine if a given slide has an Agenda-based title placeholder
' Written By : Jamie Garroch of YOUpresent.co.uk
' Inputs : oSld - the slide object to be examined
' Outputs : Returns true if the word "agenda" is found in a title placeholder
' Example Call : bAgendaSlide = IsSlideAgenda(ActiveWindow.View.Slide)
' Notes : Search is case insensitive
' ===========================================================================
Function IsSlideAgenda(oSld As Slide) As Boolean
  With oSld.Shapes
    If .HasTitle Then
      If Trim(UCase(.Title.TextFrame.TextRange.text)) Like "*AGENDA*" Then IsSlideAgenda = True
    End If
  End With
End Function