Excel VBA MultiPage - 获取页数

时间:2013-02-04 18:39:35

标签: excel vba excel-vba

我在excel vba 2010中创建了一个多页表单。 如何获取此多页面中的页数?

谢谢, 勒索

1 个答案:

答案 0 :(得分:3)

试试这个:

Dim mulpage as Control, pge as Page, counter as Integer
For Each mulPage In Me.Controls
       If TypeName(mulPage) = "MultiPage" Then
           For Each pge In mulPage.Pages
               counter = counter + 1
           Next pge
       End If
Next
  

<强> My code is in 2003. So for you, you need to reference the Form Page property explicitly using Dim pge As msforms.Page instead of Dim pge As Page for 2007, 2010...going forward.

参考文献: