从多页面获取activecontrol名称和值 [英] Getting the activecontrol name and value from a multipages form

查看:150
本文介绍了从多页面获取activecontrol名称和值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在网上搜索了几个月的解决方案,没有任何成功。
我在 Excel 2010 a UserForm 中创建多页。我正在尝试编写一个函数,将获得 activecontrol 名称和值。

I've been searching the web for a solution for a couple of months without any success. I created in Excel 2010 a UserForm with multipages. I'm trying to write a function that will get the activecontrol name and value.

到目前为止,我成功使用这个命令获取控件的名称
Me.MultiPage1.Pages(Me.MultiPage1.Value).ActiveControl.Name 但是我唯一能够做它是将它设置为变量作为字符串。
我仍​​然需要得到它的价值。

Until now, I succeeded in getting the name of the control using this command Me.MultiPage1.Pages(Me.MultiPage1.Value).ActiveControl.Name but the only thing I managed to do with it was to set it in to a variable as a string. I still need to get it's value.

我真的很感激任何帮助。
blackmail

I really appreciate any help. blackmail

推荐答案

您可以使用以下代码访问MultiPage控件中最后一个主动控件的值: p>

You can access the value of the last active control in the MultiPage control with this code:


Me.MultiPage1(Me.MultiPage1.Value).ActiveControl.Value

但是,我不知道每种类型的控件都有一个 .Value 属性,因此请确保Multipage中的所有不同控件都有一个 - 或者包含一个正确的错误处理程序!

However, I'm not sure that every kind of control has a .Value property, so make sure that all your different controls in the Multipage has one - or include a proper error handler!

这篇关于从多页面获取activecontrol名称和值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆