首页 文章

在VBA - Powerpoint中打印目录时忽略隐藏的幻灯片

提问于
浏览
1

我想在我的powerpoint演示文稿的开头写一个目录 .

我已经获取了具有 Headers 的所有幻灯片的代码,并将它们与索引一起打印 .

我想知道在哪里可以找到确定隐藏幻灯片的命令 . 我搜索了msdn VBA Powerpoint部分,但是空了 .

例如,我目前的项目是:

For y = 3 To ActivePresentation.Slides.Count
Set Diapo = ActivePresentation.Slides(y)
'si la diapo a un titre
If Diapo.Shapes.HasTitle Then
Set titre = Diapo.Shapes.Title
texte_ajout = texte_ajout & Format(y, "0 - ") & titre.TextFrame. _
TextRange.Text & Chr(13) & vbCrLf
End If
Next y

它会计算所有幻灯片,包括可能隐藏的幻灯片 .

我希望(如果可能的话)在设置Diapo之前和之后写出这个

If Diapo.SlideShowTransition.Hidden = msoTrue Then
Set counthidden = counthidden + 1

...

texte_ajout = texte_ajout & Format(y-counthidden, "0 - ") & titre.TextFrame. _
TextRange.Text & Chr(13) & vbCrLf
End If

(我将counthidden定义为字节优先,然后一样长,但它不起作用)是否可能?

1 回答

  • 2

    干得好 ;)

    For y = 3 To ActivePresentation.Slides.Count
        Set Diapo = ActivePresentation.Slides(y)
        If Diapo.SlideShowTransition.Hidden = msoTrue Then 'other value : msoFalse
            CountHidden = CountHidden + 1
        Else
            'The slide is not hidden
            If Diapo.Shapes.HasTitle Then
                'si la diapo a un titre
                Set titre = Diapo.Shapes.Title
                texte_ajout = texte_ajout & Format(y - CountHidden, "0 - ") & titre.TextFrame. _
                    TextRange.Text & Chr(13) & vbCrLf
            End If
        End If
    Next y
    

相关问题