在userform multipage excel VBA上移动到下一页(move to next page on userform multipage excel VBA)

编程入门 行业动态 更新时间:2024-10-26 13:25:47
在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 Sub

that 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 Sub

Which 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

更多推荐

本文发布于:2023-07-09 16:06:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336704.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:下一页   excel   userform   multipage   page

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!