vba Excel 工作表上的 ActiveX 文本框控件文本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14628997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ActiveX Text Box Control Text on Excel Worksheet
提问by user1423997
In VBA, how do I access the text value of an ActiveX text box control on an Excel worksheet?
在 VBA 中,如何访问 Excel 工作表上 ActiveX 文本框控件的文本值?
Thanks.
谢谢。
回答by chuff
You can use ActiveSheet.TextBox1.Text
to set or get the contents of an ActiveX textbox control.
您可以使用ActiveSheet.TextBox1.Text
来设置或获取 ActiveX 文本框控件的内容。
If you have more than one ActiveX textbox on a page, you can use ActiveSheet.OLEObjects("boxname").Object.Text
to set or get its contents. boxname is the name of the box in quotes ; or with no quotes, a string variable to which you have assigned the name of the textbox; or the object number of the box.
如果页面上有多个 ActiveX 文本框,则可以使用ActiveSheet.OLEObjects("boxname").Object.Text
来设置或获取其内容。boxname 是引号中的框名称;或者不带引号,一个字符串变量,您已为其分配了文本框的名称;或盒子的对象编号。
See this Microsoft documentationfor more information.
有关详细信息,请参阅此Microsoft 文档。