title: Office 2010 UserForm handling Pages in MultiPage Control
body: <p>I am currently working on migrating from Office 2002 SP3 to Office 2010.</p>
  
  <p>In an Excel Workbook with heavy use of VBA i am running into the following Problem:</p>
  
  <p>The following function is working like a charme in 2002, but crashes when opened with 2010.</p>
  
  <pre><code>Private Function fktSeeall()
     Dim pPage As Page, cCont As Control, mpMultiPage As Control
  
     If Seeall Then
         cbButton2.Caption = "Leere ausblenden"
     Else
         cbButton2.Caption = "Alle anzeigen"
     End If
     For Each mpMultiPage In Me.Controls
         If TypeName(mpMultiPage) = "MultiPage" Then
             For Each pPage In mpMultiPage.Pages
                 pPage.Visible = Seeall
                 For Each cCont In pPage.Controls
                     If TypeName(cCont) = "TextBox" And cCont.Text &lt;&gt; "" Then
                         pPage.Visible = True
                         mpMultiPage.Value = Right(pPage.Name, 1) - 1
                     End If
                 Next cCont
             Next pPage
         End If
     Next
  End Function
  </code></pre>
  
  <p>The boolean <code>Seeall</code> is set outside the function.
  All pages are containing one textbox. If seeall is set to false, every Page exept the ones with filled Textboxes are hidden. If set to true, all Pages are shown again.</p>
  
  <p>Office 2010 fails at the line
  <code>For Each pPage In mpMultiPage.Pages</code> with error message code 13 "Type Dismatch"</p>
  
  <p>It also fails if i use </p>
  
  <pre><code>For Each pPage In MultiPage1.Pages
      pPage.Visible = Seeall
      For Each cCont In pPage.Controls
          If TypeName(cCont) = "TextBox" And cCont.Text &lt;&gt; "" Then
              pPage.Visible = True
              MultiPage1.Value = Right(pPage.Name, 1) - 1
          End If
      Next cCont
  Next pPage
  </code></pre>
  
  <p>I dont get the point, why the new office version fails at this stage of my code.</p>
  
  <p>This is a screenshot of the UserForm:
  <img src="https://i.stack.imgur.com/JeKhR.png" alt="enter image description here"></p>