ActiveX 文本框值 [英] ActiveX textbox value

查看:54
本文介绍了ActiveX 文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Word 中获取文本框的值?我知道在 这是正确的语法:<代码>ActiveSheet.Shapes(x).Name.

How do I get the value of a textbox in Word? I know in excel this is the right syntax: ActiveSheet.Shapes(x).Name.

我认为在 这将是正确的语法
ActiveDocument.Shapes(x).Name,
但这似乎不起作用.

I thought in word this would be the right syntax
ActiveDocument.Shapes(x).Name,
but this doesn't seems to work.

使用这段代码我也找不到文本框:

With this piece of code I also couldn't find a textbox:

For i = 1 To ActiveDocument.Shapes.Count
    MsgBox ActiveDocument.Shapes(i).Name
Next i

推荐答案

我使用标签(对象属性 -> 分配标签名称)来编辑对象的值.使用以下语法更改内容控件的值:ActiveDocument.SelectContentControlsByTag("Your-Content-Control-Tag").Item(1).Range.Text = "your-preferred-value"无论如何,感谢 Rachel Hettinger 的耐心;)

I used tags (object properties -> assign a tag name) to edit the object's value. Use this syntax to change the value of a content control: ActiveDocument.SelectContentControlsByTag("Your-Content-Control-Tag").Item(1).Range.Text = "your-preferred-value" Anyway, thanks Rachel Hettinger for your patience ;).

这篇关于ActiveX 文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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