VBA : Number the slide if they are visible

前端 未结 1 1032
轻奢々
轻奢々 2021-01-24 06:21

I have a powerpoint presentation with hidden slides.

I want to number only the visible slides.

I got this code :

Sub Numerotation()
Dim x As Inte         


        
相关标签:
1条回答
  • 2021-01-24 06:58

    The MSDN example, as is so often the case, is half-accurate at best. If the Footer object isn't visible, attempting to assign text to it results in the error you're seeing. Here's a slight mod to your code that works:

    Sub Numerotation()
    Dim x As Integer
    Dim diapo As Slide
    For Each diapo In ActivePresentation.Slides
      If diapo.SlideShowTransition.Hidden = False Then
        x = x + 1
        diapo.HeadersFooters.Footer.Visible = True
        diapo.HeadersFooters.Footer.Text = CStr(x)
      Else
        diapo.HeadersFooters.Footer.Visible = False
      End If
    Next
    End Sub
    
    0 讨论(0)
提交回复
热议问题