问题描述
如何在 Word 中获取文本框的值?我知道在 excel 这是正确的语法: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
.
我认为在 word 这将是正确的语法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 文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!