title: VBA : Number the slide if they are visible
body: <p>I have a powerpoint presentation with hidden slides.</p>
  
  <p>I want to number only the visible slides.</p>
  
  <p>I got this code :</p>
  
  <pre><code>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.Text = x
    Else
      diapo.HeadersFooters.Footer.Text = ""
    End If
  Next
  End Sub
  </code></pre>
  
  <p>I got this error : </p>
  
  <pre><code>Execution Error : '-2147188160 (80048240)':
  HeaderFooter (unknown member) : Invalid request
  </code></pre>
  
  <p>I don't understand why vba doesn't recognise the HeaderFooter member (<a href="https://msdn.microsoft.com/en-us/library/office/ff745540.aspx" rel="nofollow">here is what MSDN says</a>)</p>
  
  <p>Can you help me figure out what seems to be wrong?</p>