title: Number only visible slides using master slide
body: <p>I want hidden slides in my presentation to be skipped in the slide numbering. I do, however, have a master slide that has text boxes as the footer and slide number, and this number is what I need to be updated when slides are hidden/unhidden. This is a picture of the footer in the master slide:</p>
  
  <p><a href="https://i.stack.imgur.com/SCMld.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SCMld.png" alt="enter image description here"></a></p>
  
  <p>I already tried the solution posted here but it does not work. 
  <a href="https://stackoverflow.com/questions/35266264/vba-number-the-slide-if-they-are-visible/35277025#35277025">VBA : Number the slide if they are visible</a>
  I think it's because of the master slide. This is the error I get:</p>
  
  <pre><code>Run-time error '-2147188160 (80048240)':
  HeaderFooter (unkown member) : Invalid request.
  </code></pre>
  
  <p>And when debugging it it highlights this line of code as the problem:</p>
  
  <pre><code>diapo.HeadersFooters.Footer.Text = CStr(x)
  </code></pre>