问题描述
我正在努力弄清楚如何在直接位于Excel工作表上的MultiPage表单上检测按钮按下事件.换句话说,该表单不是使用VBA生成的,而是直接构建在工作表上的.
I am struggling to figure out how to detect a button press event on a MultiPage form that resides directly on an Excel sheet. In other words, the form is not generated using VBA, it is built directly on the sheet.
我希望语法类似于:
Private Sub MultiPage1_Frame1_CommandButton1_Click()
Do Stuff
End Sub
但是,这不起作用,因为我认为我还需要在MultiPage中指定页面.例如,可以通过以下方式访问相同表单上的文本框:
However, that doesn't work because I think I also need to specify the page in the MultiPage. For example, a text box on the same form can be accessed via:
MultiPage1.Pages(0).Frame1.TextBox1.Text = "Some Text"
不幸的是
Private Sub MultiPage1_Pages(0)_Frame1_CommandButton1_Click()
出现编译错误:预期:标识符,其中的零(0)处于选中状态.
gives a Compile error: Expected: identifier with the zero inside (0) selected.
所以,如何转换
MultiPage1.Pages(0).Frame1.CommandButton1
为将检测按钮按下事件的子名称?
to a Sub name that will detect the button press event?
谢谢!
推荐答案
MrExcel.com上的Mikerickson和Jaafar Tribak知道了:
Mikerickson and Jaafar Tribak on MrExcel.com figured it out:
非常感谢他们俩!
这篇关于在Excel工作表多页表单上检测按钮按下事件(不是VBA多页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!