在userform multipage excel VBA上移动到下一页(move to next page on userform multipage excel VBA)
我有5页多页用户窗体。
如果下一个按钮被启用,它可以被用户点击,然后它应该移动到下一个隐藏页面,我总是得到一个错误“Object Required”,这让我疯狂。
Private Sub btnGenerate_Click() iPageNo = MultiPage1.Value + 1 MultiPage1.Pages(iPageNo).Visible = True MultiPage1.Value = iPageNo End Sub该代码似乎不适用于我,任何帮助将不胜感激。
谢谢
i have 5 pages in multipage userform.
if the next button enabled, which it can be clicked by user then it should move to next hidden page, i always got an error "Object Required" it drives me crazy.
Private Sub btnGenerate_Click() iPageNo = MultiPage1.Value + 1 MultiPage1.Pages(iPageNo).Visible = True MultiPage1.Value = iPageNo End Subthat code seems doesnt work for me, any help would be appreciate.
Thanks
最满意答案
当你直通时,哪条线路导致错误?
确保有足够的现有页面。 另外,MultiPage对象的名称是否已更改?
下面的代码测试工作(2页在多页1,页2设置隐藏):
Option Explicit Private Sub CommandButton1_Click() Dim iNextPage As Long With Me.MultiPage1 iNextPage = .Value + 1 If iNextPage < .Pages.Count Then .Pages(iNextPage).Visible = True .Value = iNextPage End If End With End SubWhich line is causing the error when you step thru?
Ensure there are enough existing pages. Also, has the name of the MultiPage object changed?
This code below tested working (2 Pages in MultiPage1, Page2 set hidden):
Option Explicit Private Sub CommandButton1_Click() Dim iNextPage As Long With Me.MultiPage1 iNextPage = .Value + 1 If iNextPage < .Pages.Count Then .Pages(iNextPage).Visible = True .Value = iNextPage End If End With End Sub更多推荐
发布评论