我目前的工作从办公室迁移2002 SP3到Office 2010Office 2010的用户窗体处理页面在多页控件
在Excel工作簿大量使用VBA的我遇到了以下问题:
下面的功能就像是一个风情万种,2002年,但与2010年
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 <> "" Then
pPage.Visible = True
mpMultiPage.Value = Right(pPage.Name, 1) - 1
End If
Next cCont
Next pPage
End If
Next
End Function
布尔Seeall
设置功能外打开崩溃。 所有页面都包含一个文本框。如果seeall设置为false,那么每个页面都会将具有填充文本框的页面隐藏起来。如果设置为true,则会再次显示所有页面。
的Office 2010在线路发生故障时 For Each pPage In mpMultiPage.Pages
与错误讯息代码13“类型Dismatch”
它也没有,如果我使用
For Each pPage In MultiPage1.Pages
pPage.Visible = Seeall
For Each cCont In pPage.Controls
If TypeName(cCont) = "TextBox" And cCont.Text <> "" Then
pPage.Visible = True
MultiPage1.Value = Right(pPage.Name, 1) - 1
End If
Next cCont
Next pPage
我不明白了,为什么新的Office版本失败在我的代码的这个阶段。
这是窗体的截图:
表单网页属性我不能完全弄清楚为什么还没有,但告诉我,如果你改变'昏暗PPAGE作为Page'它的工作原理'昏暗PPAGE作为Object' – osknows 2011-05-17 19:42:28